NetworkX 中的非标准化中心性分数

Un-normalizing centrality scores in NetworkX

您好,我正在尝试从 NetworkX 获取中心性分数。但是,在最新的更新中,即 NetworkX 2.1,函数如下所示:

nx.loseness_centrality(G, u=None, distance=None, wf_improved=True, reverse=False)

但是,在 NetworkX 1.9 中,函数有一个 normalize=False 函数:

nx.closeness_centrality(G, u=None, distance=None, normalized=True)

文档说:

"The closeness centrality is normalized to (n-1)/(|G|-1) where n is the number of nodes in the connected part of graph containing the node. If the graph is not completely connected, this algorithm computes the closeness centrality for each connected part separately scaled by that parts size."

如何取消中心性分数的标准化?谢谢!

旧的"normalization"命名不好(见discussion),在2.0版本更新;等效标志是 wf_improved。在新旧版本中,"normalize" 仅在具有 >1 个分量的图形中有所不同,如您引用的文档说明中所述。

# 2.1
nx.closeness_centrality(G, u=None, distance=None, wf_improved=False, reverse=False)

一样
# 1.9
nx.closeness_centrality(G, u=None, distance=None, normalized=False)