Compute degree assortativity of graph.
Assortativity measures the similarity of connections in the graph with respect to the node degree.
Parameters : | G : NetworkX graph nodes: list or iterable (optional) :
|
---|---|
Returns : | r : float
|
See also
attribute_assortativity, numeric_assortativity, neighbor_connectivity, degree_mixing_dict, degree_mixing_matrix
Notes
This computes Eq. (21) in Ref. [R137] , 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
[R137] | (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