我有兴趣在大图上运行 Newman 的模块化聚类算法。如果您可以将我指向实现它的库(或 R 包等),我将不胜感激。
纽曼图的模块化聚类
机器算法验证
聚类
网络
分区
图形
模块化
2022-04-05 14:11:35
2个回答
使用 R 的 igraph 包:http: //igraph.sourceforge.net/doc/R/fastgreedy.community.html 这使用 newman-girvan 模块化最大化方法实现了社区查找的快速算法。
您的代码将如下所示:
library(igraph)
# read graph from csv file
G<-read.graph("unipartite_edgelist.txt", format="ncol")
fgreedy<-fastgreedy.community(G,merges=TRUE, modularity=TRUE)
memberships <-community.to.membership(G, fgreedy$merges, steps=which.max(fgreedy$modularity)-1)
print(paste('Number of detected communities=',length(memberships$csize)))
# Community sizes:
print(memberships$csize)
# modularity:
max(fgreedy$modularity)
其它你可能感兴趣的问题