cityImage.calculate_centrality#
- cityImage.calculate_centrality(nx_graph, measure='betweenness', weight='weight', radius=None, attribute=None, normalized=False, backend='igraph')[source]#
Calculate centrality values for a NetworkX graph.
- Parameters:
nx_graph (
Any) – Input NetworkX graph.measure (
str) – One of"betweenness","closeness","straightness", or"reach".weight (
str) – Edge attribute used as distance/weight.radius (
float|None) – Required formeasure="reach".attribute (
str|None) – Required formeasure="reach"; node attribute to sum over reachable nodes.normalized (
bool) – Normalisation flag. Preserves the existing straightness semantics and is also passed through to NetworkX betweenness whenbackend="networkx".backend (
str) –"igraph"preserves historical cityImage behaviour."networkx"delegates standard betweenness/closeness directly to NetworkX. Reach and straightness always use the igraph-distance implementation because they are cityImage-specific helpers.
- Returns:
Mapping from original NetworkX node IDs to centrality values.
- Return type:
dict[Any,float]