#11693: Edges are doubled when creating Graphs with multiedges=True
--------------------------------+-------------------------------------------
Reporter: iandrus | Owner: iandrus
Type: defect | Status: needs_info
Priority: major | Milestone: sage-5.0
Component: graph theory | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Ivan Andrus | Merged in:
Dependencies: | Stopgaps:
--------------------------------+-------------------------------------------
Comment (by iandrus):
Replying to [comment:3 ncohen]:
> What about just testing "v == u" immediately before "data[v].append(u)"
?
That would solve the loop case, but then there is no way to specify only
one edge in a multiedge graph. Right now if you add `(1,2)` as an edge
there will be two edges between 1 and 2. If you add `(1,2),(2,1)` there
will be four and so on. Try the examples from the doctest in the patch
and you'll see what I mean.
> The problem with multiedges is that the problem is not well defined.
What should be done when the input is :
>
> * (1, 2), (2, 1)
> * (1, 2), (1, 2)
> * (1, 2, None), (1, 2, None)
> * (1, 2, 'a'), (2, 1, 'a')
> * (1, 2, 'a'), (2, 1, 'b')
I think these should all add two edges with the possible exceptions of
those which have the same label i.e. `(1, 2, None), (1, 2, None)` and `(1,
2, 'a'), (2, 1, 'a')`.
> And the same with dictionaries...
>
> * { 1 : [2], 2 : [1] }
> * { 1 : [2,2]}
> * ...
This is a little more tricky, but the second should definitely add 2
edges, and I suppose the first should add 2 as well, though it's fuzzier
to me.
I agree some of this is perhaps non-intuitive and I'm open to be
convinced, but I think adding twice as many edges is not good. :-)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11693#comment:4>
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.