2010-08-19 35 views
13

我有興趣在大圖上運行紐曼的modularity聚類算法。如果您可以指向我實現它的庫(或R包等),我將不勝感激。圖紐曼的模塊化聚類

最好 〜拉拉

+0

您也可以嘗試stats.stackexchange.com。 – mbq 2010-08-19 15:57:58

+0

@mbq:很酷,非常感謝。我會嘗試。 :) – laramichaels 2010-08-19 16:04:19

+0

似乎它的工作;-) – mbq 2010-08-19 20:17:57

回答

8

使用的igraph包R: http://igraph.sourceforge.net/doc/R/fastgreedy.community.html 這實現了使用紐曼 - 格文模塊化最大化方法社區發現一個快速算法。

你的代碼看起來就像這樣:

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) 
1

我不太確定是否開源的數據可視化工具,Gephi,與此算法運行。據我所知,它與論文中的算法一起運行:大型網絡中社區的快速展開

這也是一種基於模塊化的方法。