【发布时间】:2018-06-02 06:55:07
【问题描述】:
我有一个图 g,我想使用 igraph 在这个图中找到集群,这是我的代码:
g = Graph.Read_Ncol('karate.txt', directed=False)
p = g.community_label_propagation()
我尝试以两种方式打印集群,首先:
print(p)
秒:
for idx, cluster in enumerate(p):
print(cluster)
这是第一个的输出:
[0] 0, 1, 3, 4, 6, 7, 10, 11, 12, 13, 17, 19, 21
[1] 2, 8, 31, 30, 9, 27, 28, 32, 33, 14, 15, 18, 20, 22, 23, 25, 29, 24, 26
[2] 5, 16
第二个的输出是:
[0, 1, 3, 4, 6, 7, 9, 10, 11, 12, 13, 14, 15]
[2, 8, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
[5, 22]
我想知道为什么这两个输出中的集群不同。
【问题讨论】:
标签: python cluster-analysis igraph