NetworkX

Previous topic

networkx.algorithms.mixing.attribute_mixing_dict

Next topic

networkx.algorithms.mixing.attribute_assortativity

networkx.algorithms.mixing.degree_assortativity

networkx.algorithms.mixing.degree_assortativity(G)

Compute degree assortativity of graph.

Assortativity measures the similarity of connections in the graph with respect to the node degree.

Parameters :

G : NetworkX graph

Returns :

r : float

Assortativity of graph by degree.

Notes

This computes Eq. (21) in Ref. [R96] , where e is the joint probability distribution (mixing matrix) of the degrees. If G is directed than the matrix e is the joint probability of out-degree and in-degree.

References

[R96](1, 2) M. E. J. Newman, Mixing patterns in networks, Physical Review E, 67 026126, 2003

Examples

>>> G=nx.path_graph(4)
>>> r=nx.degree_assortativity(G)
>>> print("%3.1f"%r)
-0.5