Ticket #7724: trac_7724-ref.patch

File trac_7724-ref.patch, 1.7 KB (added by rlm, 11 years ago)
  • sage/graphs/base/c_graph.pyx

    # HG changeset patch
    # User Robert L. Miller <rlm@rlmiller.org>
    # Date 1262449027 28800
    # Node ID c7e2e10d10d6b04ab9544172ac610513fdc88e5d
    # Parent  b09b0a0aedf629b0bb8bf02d35d783b888545ae2
    Proper use of get_vertex/vertex_label
    
    diff -r b09b0a0aedf6 -r c7e2e10d10d6 sage/graphs/base/c_graph.pyx
    a b  
    14511451
    14521452           sage: DiGraph(2*graphs.PetersenGraph(),implementation="c_graph").is_connected()
    14531453           False
     1454
     1455        A graph with non-integer vertex labels::
     1456            sage: Graph(graphs.CubeGraph(3), implementation='c_graph').is_connected()
     1457            True
     1458
    14541459        """
    14551460
    14561461        cdef int v_int = 0
     
    14581463
    14591464        if v_int == -1:
    14601465            return True
    1461 
    1462         return len(list(self.depth_first_search(get_vertex(v_int, self.vertex_ints, self.vertex_labels, self._cg),\
    1463                         ignore_direction=True))\
    1464                        ) == (<CGraph>self._cg).num_verts
     1466        v = vertex_label(v_int, self.vertex_ints, self.vertex_labels, self._cg)
     1467        return len(list(self.depth_first_search(v, ignore_direction=True)) ) == (<CGraph>self._cg).num_verts
    14651468
    14661469    def is_strongly_connected(self):
    14671470        r"""
     
    14891492        if v_int == -1:
    14901493            return True
    14911494
    1492         v = get_vertex(v_int, self.vertex_ints, self.vertex_labels, self._cg)
     1495        v = vertex_label(v_int, self.vertex_ints, self.vertex_labels, self._cg)
    14931496       
    14941497        return (<CGraph>self._cg).num_verts == len(list(self.depth_first_search(v))) and \
    14951498            (<CGraph>self._cg).num_verts == len(list(self.depth_first_search(v, reverse=True)))