Skip to content

Commit

Permalink
remove isolated nodes after clearing links
Browse files Browse the repository at this point in the history
  • Loading branch information
KasiaKoz committed Nov 20, 2024
1 parent ee87c57 commit 6b434c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/genet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,11 @@ def replace_modal_subgraph(
mode_links = {link_id: {"capacity": 9999} for link_id in modal_links}
network.apply_attributes_to_links(mode_links)

# finally check and remove any isolated nodes that may have been left after removing modal links from the
# original network
logging.info("Checking for isolated nodes")
network.remove_isolated_nodes()

# report on final state, save outputs
logging.info(f"Number of nodes after adding modal graphs: {len(list(network.nodes()))}")
logging.info(f"Number of links after adding modal graphs: {len(network.link_id_mapping)}")
Expand Down

0 comments on commit 6b434c2

Please sign in to comment.