Skip to content

Commit

Permalink
Remove isolated nodes from Delwaq network.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed Nov 21, 2024
1 parent 47b4fa7 commit 2bfbb29
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)))

Check warning on line 149 in python/ribasim/ribasim/delwaq/generate.py

View check run for this annotation

Codecov / codecov/patch

python/ribasim/ribasim/delwaq/generate.py#L146-L149

Added lines #L146 - L149 were not covered by tests

for node_id in remove_nodes:
G.remove_node(node_id)

Expand Down

0 comments on commit 2bfbb29

Please sign in to comment.