networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturnsBackRef
average_degree_connectivity(G, source='in+out', target='in+out', nodes=None, weight=None)

The average degree connectivity is the average nearest neighbor degree of nodes with degree k. For weighted graphs, an analogous measure can be computed using the weighted average neighbors degree defined in , for a node i, as

$$k_{nn,i}^{w} = \frac{1}{s_i} \sum_{j \in N(i)} w_{ij} k_j$$

where :None:None:`s_i` is the weighted degree of node i, :None:None:`w_{ij}` is the weight of the edge that links i and :None:None:`j`, and :None:None:`N(i)` are the neighbors of node i.

Parameters

G : NetworkX graph
source : "in"|"out"|"in+out" (default:"in+out")

Directed graphs only. Use "in"- or "out"-degree for source node.

target : "in"|"out"|"in+out" (default:"in+out"

Directed graphs only. Use "in"- or "out"-degree for target node.

nodes : list or iterable (optional)

Compute neighbor connectivity for these nodes. The default is all nodes.

weight : string or None, optional (default=None)

The edge attribute that holds the numerical value used as a weight. If None, then each edge has weight 1.

Raises

NetworkXError

If either :None:None:`source` or :None:None:`target` are not one of 'in', 'out', or 'in+out'. If either :None:None:`source` or :None:None:`target` is passed for an undirected graph.

Returns

d : dict

A dictionary keyed by degree k with the value of average connectivity.

Compute the average degree connectivity of graph.

See Also

average_neighbor_degree

Examples

>>> G = nx.path_graph(4)
... G.edges[1, 2]["weight"] = 3
... nx.average_degree_connectivity(G) {1: 2.0, 2: 1.5}
>>> nx.average_degree_connectivity(G, weight="weight")
{1: 2.0, 2: 1.75}
See :

Back References

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

networkx.algorithms.assortativity.connectivity.average_degree_connectivity networkx.algorithms.assortativity.neighbor_degree.average_neighbor_degree

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/assortativity/connectivity.py#8
type: <class 'function'>
Commit: