This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.


local_constraint(G, u, v, weight=None)[source]

Returns the local constraint on the node u with respect to the node v in the graph G.

Formally, the local constraint on u with respect to v, denoted \(\ell(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).

  • G (NetworkX graph) – The graph containing u and v. This can be either directed or undirected.
  • u (node) – A node in the graph G.
  • v (node) – A node in the graph G.
  • weight (None or string, optional) – If None, all edge weights are considered equal. Otherwise holds the name of the edge attribute used as weight.

The constraint of the node v in the graph G.

Return type:


See also



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