From 22f298af4439421f0d51333a1def841b0d06bbac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Hu=C5=A1ek?= <husek@iuuk.mff.cuni.cz> Date: Wed, 15 Feb 2017 11:23:15 +0100 Subject: [PATCH] groupConnectivityNaive.py: add prettifyGraph --- groupConnectivityNaive.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/groupConnectivityNaive.py b/groupConnectivityNaive.py index af4c4bc..5bbd2fe 100644 --- a/groupConnectivityNaive.py +++ b/groupConnectivityNaive.py @@ -1,5 +1,12 @@ from sage.graphs.graph import Graph, DiGraph +def prettifyGraph(G_): + """Convert graph into directed one and number its edges.""" + + E = [ (u, v, i) for i, (u, v, _) in enumerate(G_.edges()) ] + return DiGraph([G_.vertices(), E], format='vertices_and_edges') + + def flowEnumerator(G, group): """Enumerate all flows of given graph. -- GitLab