networkx.algorithms.local_reaching_centrality¶
-
networkx.algorithms.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 [R770].
Parameters: G : DiGraph
A NetworkX graph.
v : node
A node in the directed graph G.
paths : dictionary
If this is not
Noneit 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 : object
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
Whether to normalize the edge weights by the total sum of edge weights.
Returns: h : float
The local reaching centrality of the node
vin the graphG.See also
References
[R770] (1, 2) Mones, Enys, Lilla Vicsek, and Tamás Vicsek. “Hierarchy Measure for Complex Networks.” PLoS ONE 7.3 (2012): e33799. https://dx.doi.org/10.1371/journal.pone.0033799 Examples
>>> import networkx as nx >>> G = nx.DiGraph() >>> G.add_edge(1, 2) >>> G.add_edge(1, 3) >>> nx.local_reaching_centrality(G, 3) 0.0 >>> G.add_edge(3, 2) >>> nx.local_reaching_centrality(G, 3) 0.5