momepy.
local_straightness_centrality
(graph, radius=5, name='straightness', distance=None, weight='mm_len')[source]¶Calculates local straightness for each node based on the defined distance.
Subgraph is generated around each node within set radius. If distance=None, radius will define topological distance, otherwise it uses values in distance attribute.
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()
number of topological steps defining the extent of subgraph
calculated attribute name
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.
Use the specified edge attribute as the edge distance in shortest path calculations in closeness centrality algorithm
networkx.Graph
Examples
>>> network_graph = mm.local_straightness_centrality(network_graph, radius=400, distance='edge_length')