2024-09-28 20:53:34 发布
网友
我需要检测网络中的社区。 但是,我不能得到会员资格
# Script from igraph import * karate = Graph.Read_Pajek("karate.gml") karate.simplify() cl = karate.community_fastgreedy() print cl.membership # ---> Not work
有人知道如何获得会员吗?在
此方法返回一个完整的树状图,因此需要先将其转换为聚类。在
from igraph import * karate = Nexus.get("karate") cl = karate.community_fastgreedy() cl.as_clustering().membership # [0, 1, 1, 1, 0, 0, 0, 1, 2, 1, 0, 0, 1, 1, 2, 2, 0, 1, 2, 0, # 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
此方法返回一个完整的树状图,因此需要先将其转换为聚类。在
相关问题 更多 >
编程相关推荐