From 9f8bce27b5d3d143493b7273513ccae8f50c7100 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Thu, 9 Mar 2023 22:23:40 +0100 Subject: [PATCH] Rename n2 to v2 and n3 to v3 So the comparison with `segments.py` is easier. --- Trajectories/Tests/segments_networkx.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Trajectories/Tests/segments_networkx.py b/Trajectories/Tests/segments_networkx.py index d36e3fb9..d758fc26 100755 --- a/Trajectories/Tests/segments_networkx.py +++ b/Trajectories/Tests/segments_networkx.py @@ -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]) -- GitLab