Opened 11 years ago

Last modified 7 years ago

#10874 closed enhancement

Add support for keep_labels in Digraph.strongly_connected_components_digraph — at Version 2

Reported by: nthiery Owned by: jason, ncohen, rlm
Priority: major Milestone: sage-4.7
Component: graph theory Keywords: strongly connected components
Cc: ncohen Merged in:
Authors: Nicolas M. Thiéry Reviewers: Nathann Cohen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by ncohen)

With keep_labels=True, the method Digraph.strongly_connected_components_digraph keeps the label on edges when contracting strongly connected components, and returns a multi-digraph::

            sage: g = DiGraph({0:{1:"0-12", 2: "0-12", 3: "0-3"}, 1: {2: "1-2", 3: "1-3"}, 2:{1: "2-1", 3: "2-3"}})
            sage: scc_digraph = g.strongly_connected_components_digraph(keep_labels = True)
            sage: scc_digraph.edges()
            [({0}, {3}, "0-3"), ({0}, {1, 2}, '0-12'),
             ({1, 2}, {3}, '1-3'), ({1, 2}, {3}, '2-3'),
             ({1, 2}, {1, 2}, '1-2'), ({1, 2}, {1, 2}, '2-1')]

APPLY:

  • trac_10874-graph-strongly_connected_componnents-nt.patch
  • trac_10874-reviewer.patch

Change History (3)

comment:1 Changed 11 years ago by nthiery

  • Status changed from new to needs_review

comment:2 Changed 11 years ago by ncohen

  • Description modified (diff)

What about avoiding to test "keep_labels" twice ? :-)

Here is a reviewer patch which does just that. Your patch is good to go, so you can set this ticket to "positive review" if you agree with my modifications, and also if you don't for some reason (please update the "apply" section in this case) :-)

Nathann

Changed 11 years ago by ncohen

Note: See TracTickets for help on using tickets.