momepy.proportion#
- 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
.Subgraph is generated around each node within set radius. If
distance=None
, radius will define topological distance, otherwise it uses values indistance
attribute.- 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
- 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 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
- dict
dict with proportions for graph if
radius=None
Examples
>>> network_graph = mm.proportion(network_graph, three='threeway', four='fourway', dead='deadends') # noqa