Skip to content

Commit

Permalink
remove looping due to generalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
napakalas committed May 23, 2024
1 parent ef5574a commit f11c7bb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mapmaker/routing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,11 @@ def set_direction(upstream_node):
if (p[i], p[i+1]) in route_graph.edges:
route_graph.remove_edge(p[i], p[i+1])

# removing self loop due to generalisation
for edge in nx.Graph(route_graph):
if edge[0] == edge[1] and (edge[0], edge[1]) in route_graph:
route_graph.remove_edge(edge[0], edge[1])

if debug:
return (route_graph, G, connectivity_graph, terminal_graphs) # type: ignore
else:
Expand Down

0 comments on commit f11c7bb

Please sign in to comment.