#9362: Invalidate None as a vertex label.
----------------------------+-----------------------------------------------
Reporter: boothby | Owner: jason, mvngu, ncohen, rlm
Type: defect | Status: needs_review
Priority: major | Milestone:
Component: graph theory | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
----------------------------+-----------------------------------------------
Changes (by brunellus):
* status: new => needs_review
Comment:
I am not sure whether this patch catches every possible way a None-labeled
vertex can sneak in, but I tried to go through the code and repair such
cases.
Please, apply first the patch from #11739 before testing.
During testing I noticed that
{{{
sage: G=Graph(); G.add_edge(None, 4); G.vertices()
[0, 4]
sage: G=Graph(); G.add_edge(5, None)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/root/Sage/sageNoneVertex/devel/sage-main/sage/graphs/<ipython console> in
<module>()
/root/Sage/sage/local/lib/python2.6/site-
packages/sage/graphs/generic_graph.pyc in add_edge(self, u, v, label)
7556 u, v, label = u
7557 except:
-> 7558 u, v = u
7559 label = None
7560 else:
TypeError: 'sage.rings.integer.Integer' object is not iterable
}}}
That is unpleasant asymmetry, don't you think? So I modified the code a
little and now it works as expected.
{{{
sage: G=Graph(); G.add_edge(5, None); G.vertices()
[0, 5]
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9362#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.