#12135: Multiple loops handling in c_graph
----------------------------+-----------------------------------------------
Reporter: brunellus | Owner: jason, ncohen, rlm
Type: defect | Status: new
Priority: major | Milestone: sage-4.8
Component: graph theory | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
----------------------------+-----------------------------------------------
Sage handles multiple loops on one vertex inconsistently.
{{{
sage:g=Graph({0:[0,0]}, loops=True, multiple_edges=True,
implementation="c_graph")
sage:g.edges()
[(0, 0, None), (0, 0, None)]
sage:g.delete_edge(0,0)
sage:g.edges()
[]
}}}
Compare with
{{{
sage:g=Graph({0:[0,0]}, loops=True, multiple_edges=True,
implementation="networkx")
sage:g.edges()
[(0, 0, None), (0, 0, None)]
sage:g.delete_edge(0,0)
sage:g.edges()
[(0, 0, None)]
}}}
and
{{{
sage:g=Graph({0:[1,1]}, loops=True, multiple_edges=True,
implementation="c_graph")
sage:g.edges()
[(0, 1, None), (0, 1, None)]
sage:g.delete_edge(0,1)
sage:g.edges()
[(0, 1, None)]
}}}
Another c_graph backend functions work in this spirit: for example
add_edges won't add any new loops to the vertex where some already exist.
Well, that is not precise. Look:
{{{
sage:g=Graph({0: [0]}, loops=True, multiple_edges=True,
implementation="c_graph")
sage:g.add_edges([(0,0), (0,0)])
sage:g.edges()
[(0, 0, None)]
sage:h=Graph({0: [0,0]}, loops=True, multiple_edges=True,
implementation="c_graph")
sage:h.add_edges([(0,0), (0,0)])
sage:h.edges()
[(0, 0, None), (0, 0, None), (0, 0, None), (0, 0, None)]
}}}
I guess that multiple loops can be handy to have, for example when you
want to preserve edges in repeated contractions. It is also consistent
with the meaning of the two options "allow loops" and "allow multiple
edges" -- it would be weird if "allow multiple edges" stopped work in the
previously allowed case of (v,v) edge.
But I'm not very experiences mathematician, so I can't decide what
behavior is right. I just see that the current state is... bizzare... :-)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12135>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.