def degree_pearson_correlation_coefficient(G, x='out', y='in', weight=None, nodes=None):
 try:
  import scipy.stats as stats
 except ImportError:
  raise ImportError('Assortativity requires SciPy: http://scipy.org/ ')
 xy = node_degree_xy(G, x=x, y=y, nodes=nodes, weight=weight)
 (x, y) = zip(*xy)
 return stats.pearsonr(x, y)[0]

def degree_pearson_correlation_coefficient ( G , x = 'out' , y = 'in' , weight = None , nodes = None ) : try : import scipy . stats as stats except ImportError : raise ImportError ( 'Assortativity requires SciPy: http://scipy.org/ ' ) xy = node_degree_xy ( G , x = x , y = y , nodes = nodes , weight = weight ) ( x , y ) = zip ( * xy ) return stats . pearsonr ( x , y ) [ 0 ]
compute degree assortativity of graph .