momepy.
subgraph
(graph, radius=5, distance=None, meshedness=True, cds_length=True, mode='sum', degree='degree', length='mm_len', mean_node_degree=True, proportion={3: True, 4: True, 0: True}, cyclomatic=True, edge_node_ratio=True, gamma=True, local_closeness=True, closeness_weight=None)[source]¶Calculates all subgraph-based characters.
Generating subgraph might be a time consuming activity. If we want to use the same
subgraph for more characters, subgraph
allows this by generating subgraph and
then analysing it using selected options.
Graph representing street network.
Ideally genereated from GeoDataFrame using momepy.gdf_to_nx()
radius defining the extent of subgraph
Use specified edge data key as distance. For example, setting distance=’weight’ will use the edge weight to measure the distance from the node n.
Calculate meshedness (True/False)
Calculate cul-de-sac length (True/False)
if ‘sum’, calculate total cds_length, if ‘mean’ calculate mean cds_length
name of attribute of node degree (momepy.node_degree()
)
name of attribute of segment length (geographical)
Calculate mean node degree (True/False)
Calculate proportion {3: True/False, 4: True/False, 0: True/False}
Calculate cyclomatic complexity (True/False)
Calculate edge node ratio (True/False)
Calculate gamma index (True/False)
Calculate local closeness centrality (True/False)
Use the specified edge attribute as the edge distance in shortest path calculations in closeness centrality algorithm
networkx.Graph
Examples
>>> network_graph = mm.subgraph(network_graph)