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 of v and \(\ell(v, w)\) is the local constraint on v with respect to w [1]. For the definition of local constraint, see local_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

local_constraint

References

1

Burt, Ronald S. “Structural holes and good ideas”. American Journal of Sociology (110): 349–399.