momepy.proportion

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

Calculates the proportion of intersection types 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.

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

threestr, optional

attribute name for 3-way intersections proportion

fourstr, optional

attribute name for 4-way intersections proportion

deadstr, optional

attribute name for deadends proportion

degreestr

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.

Returns
Graph

networkx.Graph

Examples

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