momepy.edge_node_ratio¶

momepy.
edge_node_ratio
(graph, radius=5, name='edge_node_ratio', distance=None, verbose=True)[source]¶ Calculates edge / node ratio 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 indistance
attribute.\[\alpha=e/v\]where \(e\) is the number of edges in subgraph and \(v\) is the number of nodes in subgraph.
Adapted from [DPR+17].
 Parameters
 graphnetworkx.Graph
Graph representing street network. Ideally generated from GeoDataFrame using
momepy.gdf_to_nx()
 radius: int
Include all neighbors of distance <= radius from n
 namestr, optional
calculated attribute name
 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
edge / node ratio for graph if
radius=None
Examples
>>> network_graph = mm.edge_node_ratio(network_graph, radius=3)