NetworkX

Previous topic

networkx.betweenness_centrality

Next topic

networkx.load_centrality

Quick search

networkx.betweenness_centrality_source

betweenness_centrality_source(G, normalized=True, weighted_edges=False, sources=None)

Compute betweenness centrality for a subgraph.

Enchanced version of the method in centrality module that allows specifying a list of sources (subgraph).

weighted_edges:: consider edge weights by running Dijkstra’s algorithm (no effect on unweighted graphs).

sources:: list of nodes to consider as subgraph

See Sec. 4 in Ulrik Brandes, A Faster Algorithm for Betweenness Centrality. Journal of Mathematical Sociology 25(2):163-177, 2001. http://www.inf.uni-konstanz.de/algo/publications/b-fabc-01.pdf

This algorithm does not count the endpoints, i.e. a path from s to t does not contribute to the betweenness of s and t.