2024-09-28 05:24:08 发布
网友
我正在使用pythonigraph进行社区检测。我实现了我自己的社区检测算法,该算法生成一个list[list]对象,如[[1,2,3]、[4,5,6]、[7,8,9]]。现在我想知道我的社区检测结果的模块性,我必须将list[list]对象转换为python igraph VertexClustering对象,以使用VertexClustering.modularity函数。我该怎么做
嗯,这比看起来容易
您只需创建一个VertexExclustering对象,将图形和簇标签作为参数提供:
partition = VertexClustering(g, kmeans.labels_) plot(partition)
这意味着您必须首先通过添加节点和边来构建图形
VertexClustering类文档here
我有点晚了,不过也许有人会发现这个答案很有用
嗯,这比看起来容易
您只需创建一个VertexExclustering对象,将图形和簇标签作为参数提供:
这意味着您必须首先通过添加节点和边来构建图形
VertexClustering类文档here
我有点晚了,不过也许有人会发现这个答案很有用
相关问题 更多 >
编程相关推荐