13

我有兴趣在大图上运行 Newman 的模块化聚类算法。如果您可以将我指向实现它的库(或 R 包等),我将不胜感激。

最好的〜劳拉

4

3 回答 3

9

使用 R 的 igraph 包:http: //igraph.sourceforge.net/doc/R/fastgreedy.community.html 这使用 newman-girvan 模块化最大化方法实现了社区查找的快速算法。

您的代码将如下所示:

library(igraph)
# read graph from csv file
G<-read.graph("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)
于 2012-10-25T19:07:13.257 回答
1

我不太确定开源数据可视化工具Gephi是否使用该算法运行。据我所知,它与论文中的算法一起运行:大型网络中社区的快速展开

它也是一种基于模块化的方法。

于 2014-06-04T08:19:22.623 回答
0

优秀的 networkx 包中有一个方法可以返回 Newman-Watts-Strogatz 小世界图。

于 2010-09-25T01:01:18.720 回答