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:
- GDiGraph
A NetworkX DiGraph.
- vnode
A node in the directed graph
G
.- pathsdictionary (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.- weightNone 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.- normalizedbool, optional (default=True)
Whether to normalize the edge weights by the total sum of edge weights.
- Returns:
- hfloat
The local reaching centrality of the node
v
in the graphG
.
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
Examples
>>> 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