- momepy.edge_node_ratio(graph, radius=5, name='edge_node_ratio', distance=None, verbose=True)#
Calculates edge / node ratio for subgraph around each node if radius is set, or for whole graph, if
radius=None. A subgraph is generated around each node within set radius. If
distance=None, radius will define topological distance, otherwise it uses values in
where \(e\) is the number of edges in subgraph and \(v\) is the number of nodes in subgraph.
Adapted from [Dibble et al., 2017].
A Graph representing a street network. Ideally generated from GeoDataFrame using
- radius: int
Include all neighbors of distance <= radius from
- namestr, optional
The calculated attribute name.
- distancestr, optional
Use specified edge data key as distance. For example, setting
distance=’weight’will use the edge
weightto measure the distance from the node
- verbosebool (default True)
True, shows progress bars in loops and indication of steps.
A networkx.Graph object if
The edge / node ratio for the graph if
>>> network_graph = mm.edge_node_ratio(network_graph, radius=3)