我无法计算简单 NetworkX 加权图的中心性。
这是正常的还是我做错了什么?
我在 for 循环中添加了一个简单的边add_edge(c[0],c[1],weight = my_values)
,其中
c[0],c[1]
是字符串(节点的名称)和整数。my_values
这是结果边缘的示例:
('first node label', 'second node label', {'weight': 14})
(节点的数量并不重要——现在我只保留 20 个)
我的图表的边缘列表是一个元组列表,带有 (string_node1,string_node2,weight_dictionary) - 一切看起来都很好,因为我还能够绘制/保存/读取/图表...
为什么?:
nx.degree_centrality
给我全1?nx.closeness_centrality
给我全1?
例子:
{'first node name': 1.0,
...
'last node name': 1.0}
谢谢你的帮助。