networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturns
node_redundancy(G, nodes=None)

The redundancy coefficient of a node :None:None:`v` is the fraction of pairs of neighbors of :None:None:`v` that are both linked to other nodes. In a one-mode projection these nodes would be linked together even if :None:None:`v` were not there.

More formally, for any vertex :None:None:`v`, the redundancy coefficient of `v` is defined by

$$rc(v) = \frac{|\{\{u, w\} \subseteq N(v), \: \exists v' \neq v,\: (v',u) \in E\: \mathrm{and}\: (v',w) \in E\}|}{ \frac{|N(v)|(|N(v)|-1)}{2}},$$

where :None:None:`N(v)` is the set of neighbors of :None:None:`v` in G.

Parameters

G : graph

A bipartite graph

nodes : list or iterable (optional)

Compute redundancy for these nodes. The default is all nodes in G.

Raises

NetworkXError

If any of the nodes in the graph (or in nodes , if specified) has (out-)degree less than two (which would result in division by zero, according to the definition of the redundancy coefficient).

Returns

redundancy : dictionary

A dictionary keyed by node with the node redundancy value.

Computes the node redundancy coefficients for the nodes in the bipartite graph G.

Examples

>>> from networkx.algorithms import bipartite
>>> G = nx.cycle_graph(4)
>>> rc = bipartite.node_redundancy(G)
>>> rc[0]
1.0
>>> from networkx.algorithms import bipartite
>>> G = nx.cycle_graph(4)
>>> rc = bipartite.node_redundancy(G)
>>> sum(rc.values()) / len(G)
1.0
>>> from networkx.algorithms import bipartite
>>> G = nx.cycle_graph(4)
>>> rc = bipartite.node_redundancy(G)
>>> nodes = [0, 2]
>>> sum(rc[n] for n in nodes) / len(nodes)
1.0
See :

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/bipartite/redundancy.py#9
type: <class 'function'>
Commit: