Ask Your Question
1

Digraphs database

asked 2022-03-30 05:29:37 +0200

bobby.mir gravatar image

I'm interested in the list of digraphs without muliedges and I used the following command, but it does not give me back any output.

for G in digraphs(3,lambda G: G.allow_multiple_edges(False)):
     print(G.show())

I'm wondering why there is no output and how I can fix it.

edit retag flag offensive close merge delete

Comments

G.allow_multiple_edges is returning nothing, but acting on the graph's options

FrédéricC gravatar imageFrédéricC ( 2022-03-30 08:23:23 +0200 )edit

The digraphs returned by the digraphs generator are simple (multiple edges not allowed).

If you want digraphs without symmetric pairs, you can do:

sage: for g in digraphs(3):
....:     if any(g.has_edge(v, u) for u, v in g.edge_iterator(labels=False)):
....:         continue
....:     print(g.edges(labels=False))
David Coudert gravatar imageDavid Coudert ( 2022-03-30 09:09:20 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2022-03-30 10:58:20 +0200

slelievre gravatar image

To get all the connected directed graphs on 3 vertices (no multiple directed edges, no loops) up to isomorphism, one can use graphs.nauty_geng and digraphs.nauty_directg as follows:

sage: n = 3

sage: graphs_n = [g for g in graphs.nauty_geng(f"-c {n}")]
sage: digraphs_n = list(digraphs.nauty_directg(graphs_n))

sage: len(digraphs_n)
13

sage: opt = dict(layout='circular', vertex_size=600, vertex_labels=False)
sage: opt = dict(xmin=-1, xmax=1, ymin=-0.7, ymax=1.1, **opt)
sage: G = graphics_array([g.plot(**opt) for g in digraphs_n], ncols=5)

sage: G.show(figsize=(17, 9))
Launched png viewer for Graphics Array of size 3 x 5

Connected directed graphs on 3 vertices

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: 2022-03-30 05:29:37 +0200

Seen: 328 times

Last updated: Mar 30 '22