Ask Your Question
0

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

asked 2020-11-25 10:27:09 +0200

anonymous user

Anonymous

updated 2022-03-09 08:24:25 +0200

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 flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2020-11-25 13:19:11 +0200

fidbc gravatar image

updated 2020-11-25 13:26:34 +0200

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.

edit flag offensive delete link more

Comments

thanks for your help! it looks good!

licheng gravatar imagelicheng ( 2020-11-27 14:42:12 +0200 )edit
0

answered 2022-03-09 08:22:57 +0200

licheng gravatar image

updated 2022-03-09 08:23:43 +0200

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)
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

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

Seen: 339 times

Last updated: Mar 09 '22