#14967: Bug with DiGraph
-----------------------------+-------------------------------
    Reporter:  mercatp       |            Owner:
        Type:  defect        |           Status:  new
    Priority:  major         |        Milestone:  sage-5.11
   Component:  graph theory  |         Keywords:  graph
   Merged in:                |          Authors:  Paul Mercat
   Reviewers:                |  Report Upstream:  N/A
 Work issues:                |           Branch:
Dependencies:                |         Stopgaps:
-----------------------------+-------------------------------
 I've found the following bug with DiGraph :
 {{{#!python
 sage: G=DiGraph({0:{},1/2:{}});G
 DiGraph on 1 vertex
 }}}
 I've found where is the error. It's in the file
 $SAGE_ROOT/sage/graphs/base/c_graph.pyx, in function get_vertex :
 {{{#!python
 try:
     u_int = u
 except StandardError:
     return -1
 }}}
 should be replaced by :
 {{{#!python
 from sage.rings.integer_ring import IntegerRing
 if u in IntegerRing():
     u_int = int(u)
 else:
     return -1
 }}}
 I've tried, and it corrects the problem.

 But I'm not sure that it's the right way to correct the problem, because I
 don't understand exactly how this code works. For me it's very weird (and
 a source of bugs) to distinguish whether or not u is an integer : it
 should be any hashable vertex and that's all. Why they wants to have the
 integer corresponding to u (as an index in the hash table) be equal to u
 when u is an integer ?

--
Ticket URL: <http://trac.sagemath.org/ticket/14967>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to