[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Please check my procedure of community detection

From: Zhigang Wu
Subject: [igraph] Please check my procedure of community detection
Date: Fri, 28 Mar 2008 12:05:28 +0800

Dear all,


Please find my procedure of community detection as follow:


0. Load the igraph package into R environment;

1. Read the topology:

> nfgraph1 = read.graph("nf12fd.net", format = "edgelist", dir = FALSE)

> nfgraph = simplify(nfgraph1, remove.multiple = TRUE, remove.loops = TRUE)

2. Set the edge weights:

> edgeweight = read.table("nf12fd.wei")

> E(nfgraph)$weight = edgeweight

3. Community detection by fastgreedy algorithm:

> nfcs = fastgreedy.community(nfgraph, merges = TRUE, modularity = TRUE)

4. Find the maximum modularity and the corresponding step in the merges matrix:

> maxq = max(nfcs$modularity)

> maxqid = which.max(nfcs$modularity)

5. Convert merges into membership:

> nfcsresult = community.to.membership(nfgraph, nfcs$merges, maxqid, membership = TRUE, csize = TRUE)

6. Save the result:

> dput(nfcsresult, "nfcsresult.txt")


I wonder if the edge weights set in step 2 will affect the community results.


Best Regards


Zhigang Wu


College of Electric Power

South China University of Technology


reply via email to

[Prev in Thread] Current Thread [Next in Thread]