degree_pearson_correlation_coefficient#

degree_pearson_correlation_coefficient(G, x='out', y='in', weight=None, nodes=None)[源代码]#

计算图的程度分类。

分类性度量图中连接的相似性与节点程度之间的关系。

这与度分类系数相同,但使用了可能更快的scipy.stats.pearsonr函数。

参数
G网络X图表
x: string ('in','out')

源节点的度数类型(仅限有向图)。

y: string ('in','out')

目标节点的度数类型(仅限有向图)。

weight: string or None, optional (default=None)

保存用作权重的数值的边属性。如果没有,则每条边的权重为1。阶数是与节点相邻的边权重的总和。

nodes: list or iterable (optional)

仅为指定节点计算度的皮尔逊相关性。默认为所有节点。

返回
r浮动

图的逐度随机性。

笔记

这叫scipy.stats.pearsonr。

工具书类

1

M.E.J.Newman,网络中的混合模式物理评论E,67 026126,2003

2

Foster,J.G.,Foster,D.V.,Grassberger,P.和Paczuski,M.Edge Direction and the Structure of Networks,PNAS 107,10815-20(2010年)。

实例

>>> G = nx.path_graph(4)
>>> r = nx.degree_pearson_correlation_coefficient(G)
>>> print(f"{r:3.1f}")
-0.5