Strange behaviour of add_edges

9 views
Skip to first unread message

mhs

unread,
Dec 7, 2010, 3:57:56 PM12/7/10
to sage-devel
Hi,

I encountered a strange behaviour of the add_edges method for DiGraphs
(using SAGE 4.5.1). Perhaps this is intended behaviour, but as it
seems quiet odd to me I would like to hear the opinion of more
experienced (di)graph-users. Maybe this is a real bug...

If I define a looped, multi-edge empty digraph with

G=DiGraph({},multi_edges=True,loops=True)

I can add a couple of edges at once using

G.add_edges([[0,1],[0,1],[1,1],[0,0],[1,0],[0,1]])

this gives the correct graph (having 2 vertices and 6 edges).

Nevertheless, if I define my digraph with

G=DiGraph(multi_edges=True,loops=True)

or

G=DiGraph([],multi_edges=True,loops=True)

the same command to add edges

G.add_edges([[0,1],[0,1],[1,1],[0,0],[1,0],[0,1]])

gives a digraph on 2 vertices but with only 4 edges (the double edge
is not created).
Even stranger: If I put edge labels I can see that whenever I add more
edges afterwards an old edge gets deleted and is replaced by a new
one, but never does the graph have multi-edges.

Looking forward to an explanation of this funny behaviour.

Best
M.

mhs

unread,
Dec 7, 2010, 9:11:47 PM12/7/10
to sage-devel
Even stranger: The same happens for Graph as well.

It seems constructing an empty graph or digraph with

G=Graph(multiple_edges=True)

or

G=Graph([],multiple_edges=True)

does not set the property of being a multi-graph.

E.g. doing

G

afterwards gives the information

Graph on 0 vertices

instead of

Multi-graph on 0 vertices

Now I think it really is a bug. Is there already a ticket for this?

Best
M.
Message has been deleted

Robert Miller

unread,
Dec 8, 2010, 9:19:58 AM12/8/10
to sage-...@googlegroups.com
The keyword is "multiedges" not "multi_edges". Weird artifact of using
NetworkX as the default implementation historically...

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

--
Robert L. Miller
http://www.rlmiller.org/

Reply all
Reply to author
Forward
0 new messages