igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Re: your spinglass.community function in the R igraph libr


From: Gábor Csárdi
Subject: Re: [igraph] Re: your spinglass.community function in the R igraph library
Date: Fri, 5 Mar 2010 09:58:17 +0100

Thanks for the correction, but it is still wrong. It should be

### edge.betweenness.community
ebc <- edge.betweenness.community(G)
mods <- sapply(0:ecount(G), function(i) {
  g2 <- delete.edges(G, ebc$removed.edges[seq(length=i)])
  cl <- clusters(g2)$membership
  modularity(G, cl)
})

I.e. the clusters (=communities) are taken from the subgraph, but the
modularity is calculated on the original graph.

Best,
Gabor

On Fri, Mar 5, 2010 at 9:44 AM, Gábor Csárdi <address@hidden> wrote:
> YAnnick, yes, you are right, of course. Thanks.
>
> G.
>
> On Thu, Mar 4, 2010 at 10:25 PM, Yannick Rochat
> <address@hidden> wrote:
>> Gábor, correct me if I'm wrong, but in the following code, shouldn't you be
>> using g2 instead of G in the function ?
>>
>> Best,
>>
>> Yannick
>>
>>
>>
>> ---------------------------------------------------------------
>> Yannick Rochat - IMA - Université de Lausanne
>> http://www.unil.ch/unisciences/YannickRochat
>>
>>
>> 2010/2/7 Gábor Csárdi <address@hidden>
>>>
>>> Dear Avril,
>>>
>>> here are a bunch of examples on how get membership vectors for the
>>> various community finding algorithms. The partitioning with the
>>> maximal modularity score is chosen for the methods that return a full
>>> merge tree.
>>>
>>> memberships <- list()
>>>
>>> pause()
>>>
>>> ### edge.betweenness.community
>>> ebc <- edge.betweenness.community(G)
>>> mods <- sapply(0:ecount(G), function(i) {
>>>  g2 <- delete.edges(G, ebc$removed.edges[seq(length=i)])
>>>  cl <- clusters(G)$membership
>>>  modularity(G, cl)
>>> })
>>
>> ???
>> cl <- clusters(g2)$membership
>> modularity(g2,cl)
>> ???
>>
>>>
>>> g2 <- delete.edges(G, ebc$removed.edges[1:(which.max(mods)-1)])
>>> memberships$`Edge betweenness` <- clusters(g2)$membership
>>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>
>
>
> --
> Gabor Csardi <address@hidden>     UNIL DGM
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

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