local_constraint#
- local_constraint(G, u, v, weight=None)[source]#
Returns the local constraint on the node
u
with respect to the nodev
in the graphG
.Formally, the local constraint on u with respect to v, denoted \(\ell(u, v)\), is defined by
\[\ell(u, v) = \left(p_{uv} + \sum_{w \in N(v)} p_{uw} p_{wv}\right)^2,\]where \(N(v)\) is the set of neighbors of \(v\) and \(p_{uv}\) is the normalized mutual weight of the (directed or undirected) edges joining \(u\) and \(v\), for each vertex \(u\) and \(v\) [1]. The mutual weight of \(u\) and \(v\) is the sum of the weights of edges joining them (edge weights are assumed to be one if the graph is unweighted).
- Parameters:
- GNetworkX graph
The graph containing
u
andv
. This can be either directed or undirected.- unode
A node in the graph
G
.- vnode
A node in the graph
G
.- weightNone or string, optional
If None, all edge weights are considered equal. Otherwise holds the name of the edge attribute used as weight.
- Returns:
- float
The constraint of the node
v
in the graphG
.
See also
References
[1]Burt, Ronald S. “Structural holes and good ideas”. American Journal of Sociology (110): 349–399.