Ask Your Question

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

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)]:
DrawGraph~(graphsof5c,size=[300,300],stylesheet=[vertexborder=false,vertexpadding=20,edgecolor = "Blue",
vertexcolor="Gold"])


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

edit retag close merge delete

## 2 Answers

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.

EDIT: Updated link formatting, link not rendering correctly.

more

## Comments

thanks for your help! it looks good!

( 2020-11-27 14:42:12 +0100 )edit

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

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2020-11-25 10:27:09 +0100

Seen: 253 times

Last updated: Mar 09