networkx.algorithms.bipartite.centrality.betweenness_centrality¶
- betweenness_centrality(G, nodes)[source]¶
Compute betweenness centrality for nodes in a bipartite network.
Betweenness centrality of a node
vis the sum of the fraction of all-pairs shortest paths that pass throughv.Values of betweenness are normalized by the maximum possible value which for bipartite graphs is limited by the relative size of the two node sets [1].
Let
nbe the number of nodes in the node setUandmbe the number of nodes in the node setV, then nodes inUare normalized by dividing by\[\frac{1}{2} [m^2 (s + 1)^2 + m (s + 1)(2t - s - 1) - t (2s - t + 3)] ,\]where
\[s = (n - 1) \div m , t = (n - 1) \mod m ,\]and nodes in
Vare normalized by dividing by\[\frac{1}{2} [n^2 (p + 1)^2 + n (p + 1)(2r - p - 1) - r (2p - r + 3)] ,\]where,
\[p = (m - 1) \div n , r = (m - 1) \mod n .\]- Parameters
- Ggraph
A bipartite graph
- nodeslist or container
Container with all nodes in one bipartite node set.
- Returns
- betweennessdictionary
Dictionary keyed by node with bipartite betweenness centrality as the value.
Notes
The nodes input parameter must contain all nodes in one bipartite node set, but the dictionary returned contains all nodes from both node sets. See
bipartite documentationfor further details on how bipartite graphs are handled in NetworkX.References
- 1
Borgatti, S.P. and Halgin, D. In press. “Analyzing Affiliation Networks”. In Carrington, P. and Scott, J. (eds) The Sage Handbook of Social Network Analysis. Sage Publications. https://dx.doi.org/10.4135/9781446294413.n28