开发者

Newman's modularity clustering for graphs

I am interested in running Newman's modularity cluste开发者_如何学Cring algorithm on a large graph. If you can point me to a library (or R package, etc) that implements it I would be most grateful.

best ~lara


Use the igraph package for R: http://igraph.sourceforge.net/doc/R/fastgreedy.community.html this implements a fast algorithm for community finding using the newman-girvan modularity maximization method.

your code will look like this:

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)


I'm not quite sure whether the open-source data visualization tool, Gephi, is running with this algorithm. As I know, it runs with the algo in paper: Fast unfolding of communities in large networks

It's also a modularity based methods.


There's a method in the excellent networkx package that returns a Newman-Watts-Strogatz small world graph.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜