momepy.cds_length#
- momepy.cds_length(graph, radius=5, mode='sum', name='cds_len', degree='degree', length='mm_len', distance=None, verbose=True)[source]#
Calculates length of cul-de-sacs for subgraph around each node if radius is set, or for whole graph, if
radius=None
.Subgraph is generated around each node within set radius. If
distance=None
, radius will define topological distance, otherwise it uses values in distance attribute.- Parameters
- graphnetworkx.Graph
Graph representing street network. Ideally generated from GeoDataFrame using
momepy.gdf_to_nx()
- radiusint
Include all neighbors of distance <= radius from n
- modestr (default ‘sum’)
if
'sum'
, calculate total length, if'mean'
calculate mean length- namestr, optional
calculated attribute name
- degreestr
name of attribute of node degree (
momepy.node_degree()
)- lengthstr, optional
name of attribute of segment length (geographical)
- distancestr, optional
Use specified edge data key as distance. For example, setting
distance=’weight’
will use the edgeweight
to measure the distance from the node n.- verbosebool (default True)
if True, shows progress bars in loops and indication of steps
- Returns
- Graph
networkx.Graph if radius is set
- float
length of cul-de-sacs for graph if
radius=None
Examples
>>> network_graph = mm.cds_length(network_graph, radius=9, mode='mean')