igraph-help
[Top][All Lists]

## Re: [igraph] combining communities

 From: Claudia Muller-Birn Subject: Re: [igraph] combining communities Date: Mon, 9 Aug 2010 08:19:50 -0400

```Hi Gabor,

On Aug 9, 2010, at 4:16 AM, Gábor Csárdi wrote:

> Sorry this was not complete yet, I mean
>
> g <-  simplify(as.undirected(ba.game(100, 3)))
> sc <- spinglass.community(g)\$membership
> el <- get.edgelist(g)
> for (i in seq_len(max(sc)+1)-1) {
>  w <- which(sc==i)-1
>  el[ el %in% w ] <- w[1]
> }
> mode(el) <- "character"
> el <- unique(el)
> graph.edgelist(el, dir=FALSE)
>
> You can remove the loop edges before creating the graph:
> el <- el[ el[,1] != el[,2], ]

Interesting solution. But unfortunately, I am not experienced enough to
understand every step. Do you mind to extend your code by some comment lines
(starting with the for loop)? That would be great. Thank you very much!

> Best,
> Gabor

Claudia

>
> On Mon, Aug 9, 2010 at 10:07 AM, Gábor Csárdi <address@hidden> wrote:
>> Hi,
>>
>> in igraph 0.6 we have a function for that (contract.vertices in R),
>> but it should not be too hard to code a quick solution in R. E.g.
>>
>> g <- erdos.renyi.game(100, 1/100)
>> sc <- spinglass.community(g)\$membership
>> el <- get.edgelist(g)
>> for (i in seq_len(max(sc)+1)-1) {
>>
>> }
>>
>> On Mon, Aug 9, 2010 at 2:33 AM, Stuart Kininmonth
>>> Hi,
>>>
>>> just wondering if anyone has written any code to take a community
>>> membership identity list and combine the nodes and arcs to create a
>>> community network?
>>>
>>> thanks,
>>>
>>> Stuart Kininmonth
>>> Spatial Ecologist
>>> Australian Institute of Marine Science
>>>
>>>
>>> --
>>> ------------------------------------------------------------------------
>>> The information contained within this transmission is for the
>>> use of the intended recipient only and may contain confidential
>>> and/or legally privileged material and/or material the subject
>>> of copyright and/or personal information and/or sensitive
>>> information that is subject to the Privacy Act 1988. Any review,
>>> re-transmission, disclosure, dissemination or other use of, or
>>> taking of any action in reliance upon, this information by
>>> persons or entities other than the intended recipient is
>>> prohibited. If you have received this email in error please
>>> notify the AIMS Privacy Officer on (07) 4753 4444 and delete
>>> all copies of this transmission together with any attachments.
>>> ------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>>
>>
>>
>> --
>> Gabor Csardi <address@hidden>     UNIL DGM
>>
>
>
>
> --
> Gabor Csardi <address@hidden>     UNIL DGM
>
> _______________________________________________
> igraph-help mailing list