Skip to content
Snippets Groups Projects
Commit 9f8bce27 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Rename n2 to v2 and n3 to v3

So the comparison with `segments.py` is easier.
parent af421a3e
No related branches found
No related tags found
No related merge requests found
......@@ -15,21 +15,21 @@ for v in g: g.nodes[v]["inst_eddies"] = [v]
for v in g:
if g.in_degree[v] == 1:
n2 = next(g.predecessors(v))
v2 = next(g.predecessors(v))
if g.out_degree[n2] == 1:
if g.out_degree[v2] == 1:
# v continues a segment, circumvent v:
nbunch.append(v)
g.remove_edge(n2, v)
g.remove_edge(v2, v)
for n3 in list(g.successors(v)):
g.remove_edge(v, n3)
g.add_edge(n2, n3)
for v3 in list(g.successors(v)):
g.remove_edge(v, v3)
g.add_edge(v2, v3)
# Add the segments represented by v to the segments
# represented by n2:
g.nodes[n2]["inst_eddies"] += g.nodes[v]["inst_eddies"]
# represented by v2:
g.nodes[v2]["inst_eddies"] += g.nodes[v]["inst_eddies"]
g.remove_nodes_from(nbunch)
for k in sorted(g.nodes): print(k, g.nodes[k])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment