momepy.
closeness_centrality
Calculates the closeness centrality for nodes.
Wrapper around networkx.closeness_centrality.
networkx.closeness_centrality
Closeness centrality of a node u is the reciprocal of the average shortest path distance to u over all n-1 nodes within reachable nodes.
where \(d(v, u)\) is the shortest-path distance between \(v\) and \(u\), and \(n\) is the number of nodes that can reach \(u\).
Graph representing street network. Ideally generated from GeoDataFrame using momepy.gdf_to_nx()
momepy.gdf_to_nx()
calculated attribute name
attribute holding the weight of edge (e.g. length, angle)
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
kwargs for networkx.closeness_centrality
networkx.Graph
Examples
>>> network_graph = mm.closeness_centrality(network_graph)