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. A subgraph is generated around each node within set radius. Ifdistance=None, the radius will define topological distance, otherwise it uses values indistanceattribute.- Parameters:¶
- graph : networkx.Graph¶
A Graph representing a street network. Ideally generated from GeoDataFrame using
momepy.gdf_to_nx().- radius : int | None, optional¶
Include all neighbors of distance <= radius from
n. If None, calculate the metrics for the entire graph.- three : str, optional¶
The attribute name for 3-way intersections proportion.
- four : str, optional¶
The attribute name for 4-way intersections proportion.
- dead : str, optional¶
The attribute name for deadends proportion.
- degree : str¶
The name of attribute of node degree (
momepy.node_degree()).- distance : str, optional¶
Use specified edge data key as distance. For example, setting
distance=’weight’will use the edgeweightto measure the distance from the noden.- verbose : bool (default True)¶
If
True, shows progress bars in loops and indication of steps.
- Returns:¶
netx (Graph) – A networkx.Graph object if
radiusis set.result (dict) – A dict with proportions for the graph if
radius=None.
Examples
>>> network_graph = mm.proportion( ... network_graph, three='threeway', four='fourway', dead='deadends' ... )