igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] modularity in dense weighted networks with spinglass.commu


From: Gábor Csárdi
Subject: Re: [igraph] modularity in dense weighted networks with spinglass.community
Date: Sat, 6 Mar 2010 00:32:43 +0100

Hi Aaron,

hmmm, you are right, something strange is going on here, if I run the following:

R

library(igraph)

largest.component <- function(x) {
  cl <- clusters(x)
  ss <- which(cl$membership == which.max(cl$csize)-1)-1
  subgraph(x, ss)
}

g <- largest.component(erdos.renyi.game(100, p=5/100))
E(g)$weight <- runif(ecount(g))
sc <- spinglass.community(g, weights=E(g)$weight)
sc$modularity
modularity(g, sc$membership, weights=E(g)$weight)

sc2 <- spinglass.community(g)
sc2$modularity
modularity(g, sc2$membership)

# I get

> sc$modularity
[1] 0.2808567
> modularity(g, sc$membership, weights=E(g)$weight)
[1] 0.4861468
>
> sc2 <- spinglass.community(g)
> sc2$modularity
[1] 0.2737963
> modularity(g, sc2$membership)
[1] 0.3635749

which is clearly different, both in the weighted and unweighted case.
For spinglass.community we just use the modularity value calculated by
the community detection code, as implemented by the original author of
the algorithm.

I will check why the two values are not the same. Thanks for your report!

Best,
Gabor

On Tue, Mar 2, 2010 at 9:05 PM, Aaron Alexander-Bloch
<address@hidden> wrote:
> Hi - Thanks in advance for any help.
>
> I'm trying to apply spinglass.community in the R package to dense weighted
> networks and have some trouble interpreting the modularity value in my
> results. I'm assuming that $modularity is the value of the Hamiltonian as in
> the Reichardt/Bornholdt paper. As I'm keeping the gamma parameter at 1 and
> using the 'config' model, my understanding is that the Hamiltonian is the
> same as Newman's modularity, at least for binary graphs. But I'm not clear
> on how these concepts are related for weighted graphs. If I separately get
> the modularity value of the partition that spinglass gives me, it is
> different from the modularity value given by spinglass directly. So my
> question is how should the modularity value given by spinglass be
> interpreted for weighted graphs?
>
> In a related question, is there any plan to implement the "weighted version"
> of this method as in Heimo (2008)
>
> http://iopscience.iop.org/1742-5468/2008/08/P08007/
>
> Thanks very much!
> Aaron
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

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