momepy.proportion(graph, radius=5, three=None, four=None, dead=None, degree='degree', distance=None, verbose=True)[source]#

Calculates the proportion of intersection types 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, the radius will define topological distance, otherwise it uses values in distance attribute.


A Graph representing a street network. Ideally generated from GeoDataFrame using momepy.gdf_to_nx().

radius: int

Include all neighbors of distance <= radius from n.

threestr, optional

The attribute name for 3-way intersections proportion.

fourstr, optional

The attribute name for 4-way intersections proportion.

deadstr, optional

The attribute name for deadends proportion.


The name of attribute of node degree (momepy.node_degree()).

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.

verbosebool (default True)

If True, shows progress bars in loops and indication of steps.


A networkx.Graph object if radius is set.


A dict with proportions for the graph if radius=None.


>>> network_graph = mm.proportion(
...     network_graph, three='threeway', four='fourway', dead='deadends'
... )  # noqa