Compute degree assortativity of graph.
Assortativity measures the similarity of connections in the graph with respect to the node degree.
Parameters : | G : NetworkX graph x: string (‘in’,’out’) :
y: string (‘in’,’out’) :
weight: string or None, optional (default=None) :
nodes: list or iterable (optional) :
|
---|---|
Returns : | r : float
|
See also
attribute_assortativity_coefficient, numeric_assortativity_coefficient, neighbor_connectivity, degree_mixing_dict, degree_mixing_matrix
Notes
This computes Eq. (21) in Ref. [R97] , 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 the user-specified degree type for the source and target.
References
[R97] | (1, 2) M. E. J. Newman, Mixing patterns in networks, Physical Review E, 67 026126, 2003 |
[R98] | Foster, J.G., Foster, D.V., Grassberger, P. & Paczuski, M. Edge direction and the structure of networks, PNAS 107, 10815-20 (2010). |
Examples
>>> G=nx.path_graph(4)
>>> r=nx.degree_assortativity_coefficient(G)
>>> print("%3.1f"%r)
-0.5