NetworkX

Previous topic

networkx.attribute_mixing_dict

Next topic

networkx.attribute_assortativity

networkx.degree_assortativity

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. [R47] , 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

[R47](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