constraint¶
- constraint(G, nodes=None, weight=None)[source]¶
Returns the constraint on all nodes in the graph
G
.The constraint is a measure of the extent to which a node v is invested in those nodes that are themselves invested in the neighbors of v. Formally, the constraint on v, denoted
c(v)
, is defined by\[c(v) = \sum_{w \in N(v) \setminus \{v\}} \ell(v, w)\]where \(N(v)\) is the subset of the neighbors of
v
that are either predecessors or successors ofv
and \(\ell(v, w)\) is the local constraint onv
with respect tow
[1]. For the definition of local constraint, seelocal_constraint()
.- Parameters
- GNetworkX graph
The graph containing
v
. This can be either directed or undirected.- nodescontainer, optional
Container of nodes in the graph
G
to compute the constraint. If None, the constraint of every node is computed.- weightNone or string, optional
If None, all edge weights are considered equal. Otherwise holds the name of the edge attribute used as weight.
- Returns
- dict
Dictionary with nodes as keys and the constraint on the node as values.
See also
References
- 1
Burt, Ronald S. “Structural holes and good ideas”. American Journal of Sociology (110): 349–399.