networkx.algorithms.centrality.local_reaching_centrality¶
-
local_reaching_centrality
(G, v, paths=None, weight=None, normalized=True)[source]¶ Returns the local reaching centrality of a node in a directed graph.
The local reaching centrality of a node in a directed graph is the proportion of other nodes reachable from that node 1.
- Parameters
G (DiGraph) – A NetworkX DiGraph.
v (node) – A node in the directed graph
G
.paths (dictionary (default=None)) – If this is not
None
it must be a dictionary representation of single-source shortest paths, as computed by, for example,networkx.shortest_path()
with source nodev
. Use this keyword argument if you intend to invoke this function many times but don’t want the paths to be recomputed each time.weight (None or string, optional (default=None)) – Attribute to use for edge weights. If
None
, each edge weight is assumed to be one. A higher weight implies a stronger connection between nodes and a shorter path length.normalized (bool, optional (default=True)) – Whether to normalize the edge weights by the total sum of edge weights.
- Returns
h – The local reaching centrality of the node
v
in the graphG
.- Return type
Examples
>>> import networkx as nx >>> G = nx.DiGraph() >>> G.add_edges_from([(1, 2), (1, 3)]) >>> nx.local_reaching_centrality(G, 3) 0.0 >>> G.add_edge(3, 2) >>> nx.local_reaching_centrality(G, 3) 0.5
See also
References
- 1
Mones, Enys, Lilla Vicsek, and Tamás Vicsek. “Hierarchy Measure for Complex Networks.” PLoS ONE 7.3 (2012): e33799. https://doi.org/10.1371/journal.pone.0033799