Skip to content

Commit

Permalink
Update graph_utilities.py
Browse files Browse the repository at this point in the history
update docstring
  • Loading branch information
Dobson committed May 3, 2024
1 parent 92a99b5 commit 1d7664f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions swmmanywhere/graph_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,13 +586,16 @@ def __call__(self,
"""Clip the graph to the subcatchments.
Derive the subbasins with `subcatchment_derivation.subbasin_streamorder`.
Run Louvain community detection on the road network to create road
clusters. Each road network cluster will be assigned to whichever
catchment it has the most nodes in. Any links between clusters in
different subbasins will be removed. If more than
`subcatchment_derivation.subbasin_membership` proportion of nodes in a
road network cluster do not belong to any subbasin, the cluster will be
removed.
If no subbasins exist for that stream order, the value is iterated
downwards and a warning it flagged.
Run Louvain community detection on the street network to create street
node communities.
Communities with less than `subcatchment_derivation.subbasin_membership`
proportion of nodes in a subbasin have their links to all other nodes
in that subbasin removed. Nodes not in any subbasin are assigned to a
subbasin to cover all unassigned nodes.
Args:
G (nx.Graph): A graph
Expand Down Expand Up @@ -648,6 +651,9 @@ def __call__(self,

# Introduce a non catchment basin for nan
street_points['basin'] = street_points['basin'].fillna(-1)
# TODO possibly it makes sense to just remove these nodes, or at least
# any communities that are all nan


# Calculate most percentage of each subbasin in each community
community_basin = (
Expand Down

0 comments on commit 1d7664f

Please sign in to comment.