networkx.algorithms.structuralholes.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 ofvthat are either predecessors or successors ofvandell(v, w)is the local constraint onvwith 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
Gto 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.