Ticket #10874: trac_10874-reviewer.patch

File trac_10874-reviewer.patch, 1.4 KB (added by ncohen, 10 years ago)
  • sage/graphs/digraph.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1299249620 -3600
    # Node ID 8b0273b2f8bd1bd0e2d50d8f429beb7e3e94717f
    # Parent  c0de52a2521992c9f05e38cc4d5abc1b8d2204e6
    trac 10874 -- support for keep_labels in Digraph.strongly_connected_components_digraph
    
    diff -r c0de52a25219 -r 8b0273b2f8bd sage/graphs/digraph.py
    a b  
    26002600        Returns the digraph of the strongly connected components
    26012601
    26022602        INPUT:
     2603
    26032604         - ``keep_labels`` -- boolean (default: False)
    26042605
    26052606        The digraph of the strongly connected components of a graph `G` has
     
    26672668
    26682669        if keep_labels:
    26692670            g = DiGraph(multiedges=True, loops=True)
     2671            g.add_vertices(scc_set)
     2672            g.add_edges( set((scc_set[d[u]], scc_set[d[v]], label) for (u,v,label) in self.edges() ) )
     2673
    26702674        else:
    26712675            g = DiGraph()
    26722676            g.allow_multiple_edges(False)
    2673         g.add_vertices(scc_set)
    2674 
    2675         if keep_labels:
    2676             g.add_edges( set((scc_set[d[u]], scc_set[d[v]], label) for (u,v,label) in self.edges() ) )
    2677         else:
     2677            g.add_vertices(scc_set)
    26782678            g.add_edges( (scc_set[d[u]], scc_set[d[v]]) for u,v in self.edges(labels=False) )
     2679
    26792680        return g
    26802681
    26812682    def is_strongly_connected(self):