Commit ade48191 authored by Yoann Dufresne's avatar Yoann Dufresne
Browse files

refactor name to idx

parent 36e8ec7f
......@@ -21,8 +21,8 @@ def transitive_reduction(d2g):
dg1_name, dg2_name, data = edges.pop(0)
# Extract dgs
dg1 = d2g.node_by_name[dg1_name]
dg2 = d2g.node_by_name[dg2_name]
dg1 = d2g.node_by_idx[int(dg1_name)]
dg2 = d2g.node_by_idx[int(dg2_name)]
# Extract common neighbors
nei1 = frozenset(d2g.neighbors(dg1_name))
......@@ -32,7 +32,7 @@ def transitive_reduction(d2g):
# Look for all the common neighbors, if edge must be remove or not
current_dist = d2g[dg1_name][dg2_name]["distance"]
for node in common:
com_dg = d2g.node_by_name[node]
com_dg = d2g.node_by_idx[int(node)]
extern_dist = d2g[dg1_name][node]["distance"] + d2g[node][dg2_name]["distance"]
# If better path, remove the edge
......
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