# How to put the drawing of graphs in a matrix or list Anonymous

I have got some graphs on 5 vertices.

count = 0
for g in graphs.nauty_geng("5 1:5"):
count = count+1
print(count)


we got 19 graphs. I want to show them but get long output using following codes, and it is very bad for viewing.

   for g in graphs.nauty_geng("5 1:5"):
g.show()


I thought of using matrix or list storage these drawings of graph , but it failed.

glist= [g for g in graphs.nauty_geng("5 1:5")]
map(show,glist)


we got noting from outputs:

<map object at 0x6fdf37c3cf8>


This is what Maple did well.

with(GraphTheory):
graphsof5c := [NonIsomorphicGraphs(5, 1..5,output = graphs, outputform = graph)]:
vertexcolor="Gold"])


My points are less than 60 points, I can’t upload corresponding pictures, sorry.

edit retag close merge delete

Sort by » oldest newest most voted I think that the graphs_list.show_graphs is the function you are looking for. Using the notation from above you can execute

 sage: graphs_list.show_graphs(glist) 

This will display the graphs in glist in blocks of at most 20 graphs. Further details at the user manual.

more

plot all non-isomorphic graphs on 4 vertices

show(graphics_array([g.plot(vertex_size=30,vertex_labels=False) for g in list(graphs(4))]),figsize=5)

more