momepy.
straightness_centrality
(graph, weight='mm_len', normalized=True, name='straightness')[source]¶Calculates the straightness centrality for nodes.
where \(\mathrm{d}^{\mathrm{E} \mathrm{u}}_{\mathrm{ij}}\) is the Euclidean distance between nodes i and j along a straight line.
Graph representing street network.
Ideally genereated from GeoDataFrame using momepy.gdf_to_nx()
attribute holding length of edge
normalize to number of nodes-1 in connected part
calculated attribute name
networkx.Graph
References
Porta S, Crucitti P and Latora V (2006) The network analysis of urban streets: A primal approach. Environment and Planning B: Planning and Design 33(5): 705–725.
Examples
>>> network_graph = mm.straightness_centrality(network_graph)