尝试确定网络是否无标度时,Kolmogorov–Smirnov返回p值0.0

我正在尝试使用scipy的kstest确定网络是否无标度。在一个非常小的测试网络上,我能够实现0.1875的p值。但是,在感兴趣的网络上,p-val始终为0.0。

为了进行调查,我使用NetworkX生成了1000个节点的无标度图,但即使这样,我的p-val也得到了0.0:

import networkx as nx
from scipy.stats import kstest
import powerlaw

graph = nx.scale_free_graph(1000)

deg_dist = sorted([deg for node,deg in graph.degree()],reverse=True)
fit = powerlaw.Fit(deg_dist,discrete=True)
alpha = fit.power_law.alpha
xmin = fit.power_law.xmin
test,p = kstest(deg_dist,"powerlaw",args = (alpha,xmin),N=len(deg_dist))


print("Test: " + str(test) + "\nP: " + str(p))

有人能指出我正确的方向吗?谢谢。

编辑:使用nx生成10个节点的无标度图会导致0.000568的p值。看来p值与图的大小成反比,所以我在这里一定做错了。

yueyegouhun123 回答:尝试确定网络是否无标度时,Kolmogorov–Smirnov返回p值0.0

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3037191.html

大家都在问