degree_centrality¶
- degree_centrality(G, nodes)[source]¶
Compute the degree centrality for nodes in a bipartite network.
The degree centrality for a node
v
is the fraction of nodes connected to it.- Parameters
- Ggraph
A bipartite network
- nodeslist or container
Container with all nodes in one bipartite node set.
- Returns
- centralitydictionary
Dictionary keyed by node with bipartite degree 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 bipartite node sets. See
bipartite documentation
for further details on how bipartite graphs are handled in NetworkX.For unipartite networks, the degree centrality values are normalized by dividing by the maximum possible degree (which is
n-1
wheren
is the number of nodes in G).In the bipartite case, the maximum possible degree of a node in a bipartite node set is the number of nodes in the opposite node set [1]. The degree centrality for a node
v
in the bipartite setsU
withn
nodes andV
withm
nodes is\[ \begin{align}\begin{aligned}d_{v} = \frac{deg(v)}{m}, \mbox{for} v \in U ,\\d_{v} = \frac{deg(v)}{n}, \mbox{for} v \in V ,\end{aligned}\end{align} \]where
deg(v)
is the degree of nodev
.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