Skip to content

Commit

Permalink
Remove isolated nodes from Delwaq network. (#1948)
Browse files Browse the repository at this point in the history
As these caused off by one issues in the generated Delwaq model. First
found in the AGV model.
  • Loading branch information
evetion authored Nov 21, 2024
1 parent fe3b789 commit 06fe982
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/ribasim/ribasim/delwaq/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ def _setup_graph(nodes, edge, evaporate_mass=True):
else:
G.add_edge(*edge, id=[edge_id])

iso = nx.number_of_isolates(G)
if iso > 0:
logger.debug(f"Found {iso} isolated nodes in the network.")
remove_nodes.extend(list(nx.isolates(G)))

for node_id in remove_nodes:
G.remove_node(node_id)

Expand Down

0 comments on commit 06fe982

Please sign in to comment.