momepy.edge_node_ratio

momepy.edge_node_ratio(graph, radius=5, name='edge_node_ratio', distance=None)[source]

Calculates edge / node ratio 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.

\[\alpha=e/v\]

where \(e\) is the number of edges in subgraph and \(v\) is the number of nodes in subgraph.

Parameters
graphnetworkx.Graph

Graph representing street network. Ideally genereated from GeoDataFrame using momepy.gdf_to_nx()

radius: int

number of topological steps defining the extent of subgraph

namestr, optional

calculated attribute name

distancestr, optional

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.

Returns
Graph

networkx.Graph

References

Dibble J, Prelorendjos A, Romice O, et al. (2017) On the origin of spaces: Morphometric foundations of urban form evolution. Environment and Planning B: Urban Analytics and City Science 46(4): 707–730.

Examples

>>> network_graph = mm.edge_node_ratio(network_graph, radius=3)