igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] combining communities


From: Gábor Csárdi
Subject: Re: [igraph] combining communities
Date: Mon, 9 Aug 2010 10:16:01 +0200

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], ]

Best,
Gabor

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
> <address@hidden> wrote:
>> 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
>> 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]