Commit 0919f68c authored by yvonneanne's avatar yvonneanne
Browse files

extend init

parent 7e993140
...@@ -28,6 +28,8 @@ def init_k_graph(k, n): ...@@ -28,6 +28,8 @@ def init_k_graph(k, n):
for (u, v) in g.edges(): for (u, v) in g.edges():
g[u][v]['arb'] = -1 g[u][v]['arb'] = -1
g.graph['k'] = k g.graph['k'] = k
if 'root' not in g.graph.keys():
g.graph['root'] = 0 #set root node to be 0
return g return g
# reset the arb attribute for all edges to -1, i.e., no arborescence assigned yet # reset the arb attribute for all edges to -1, i.e., no arborescence assigned yet
...@@ -887,4 +889,4 @@ def round_robin(g, cut=False, swap=False, reset=True): ...@@ -887,4 +889,4 @@ def round_robin(g, cut=False, swap=False, reset=True):
index = (index + 1) % K index = (index + 1) % K
swappy.append(swaps) swappy.append(swaps)
g = n.g g = n.g
return get_arborescence_list(g) return get_arborescence_list(g)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment