momepy.
cds_length
(graph, radius=5, mode='sum', name='cds_len', degree='degree', length='mm_len', distance=None)[source]¶Calculates length of cul-de-sacs for subgraph around each node.
Subgraph is generated around each node within set radius. If distance=None, radius will define topological distance, otherwise it uses values in distance attribute.
Graph representing street network.
Ideally genereated from GeoDataFrame using momepy.gdf_to_nx()
number of topological steps defining the extent of subgraph
if ‘sum’, calculate total length, if ‘mean’ calculate mean length
calculated attribute name
name of attribute of node degree (momepy.node_degree()
)
name of attribute of segment length (geographical)
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.
networkx.Graph
Examples
>>> network_graph = mm.cds_length(network_graph, radius=9, mode='mean')