momepy.
straightness_centrality
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.
Adapted from [PCL06].
Graph representing street network. Ideally generated from GeoDataFrame using momepy.gdf_to_nx()
momepy.gdf_to_nx()
attribute holding length of edge
normalize to number of nodes-1 in connected part (for local straightness is recommended to set to normalized False)
calculated attribute name
Include all neighbors of distance <= radius from n
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 during ego_graph generation.
distance=’weight’
weight
if True, shows progress bars in loops and indication of steps
networkx.Graph
Examples
>>> network_graph = mm.straightness_centrality(network_graph)