networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
constraint(G, nodes=None, weight=None)

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 :None:None:`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 :None:None:`v` that are either predecessors or successors of :None:None:`v` and $\ell(v, w)$ is the local constraint on :None:None:`v` with respect to w . For the definition of local constraint, see local_constraint .

Parameters

G : NetworkX graph

The graph containing v . This can be either directed or undirected.

nodes : container, optional

Container of nodes in the graph G to compute the constraint. If None, the constraint of every node is computed.

weight : None 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.

Returns the constraint on all nodes in the graph G .

See Also

local_constraint

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.structuralholes.local_constraint networkx.algorithms.structuralholes.effective_size

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/structuralholes.py#162
type: <class 'function'>
Commit: