igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] largest connected component


From: Simone Gabbriellini
Subject: Re: [igraph] largest connected component
Date: Sun, 23 Jan 2011 12:28:35 +0100

Thanks Gabor!

best,
Simone

Il giorno 23/gen/2011, alle ore 12.03, Gábor Csárdi ha scritto:

> Hi,
> 
> On Sun, Jan 23, 2011 at 11:57 AM, Simone Gabbriellini
> <address@hidden> wrote:
>> Hello List,
>> 
>> what is the quickest way to find a largest connected component for a large 
>> graph? Consider this small graph:
>> 
>>> gclust
>> $membership
>>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
>> [24] 24  6 25 26  5 27 28 29 18 30 31 32 33  8  3 34 19 35 36 32 37 18 38
>> [47] 39 40 41 42 36 21  5  6 43  9  8 23 22 28 18 44 35 45 46 40 30 47  3
>> [70] 19 11 31 29 48 41  4 49 50 33 32
>> 
>> $csize
>>  [1] 1 1 3 2 3 3 1 3 2 1 2 1 1 1 1 1 1 4 3 1 2 2 2 1 1 1 1 2 2 2 2 3 2 1 2
>> [36] 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1
>> 
>> $no
>> [1] 50
>> 
>> the largest component is the one with size = 4. So I simply have to select 
>> the index of the one with max $csize and pass it as a $membership value. Is 
>> this correct?
> 
> Yep, which(gclust$membership == which.max(gclust$csize)) if you are
> using 0.6, but you need to fix this because of the zero-based indices
> if you are using 0.5.x.
> 
> Best,
> Gabor
> 
>> best,
>> Simone
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>> 
> 
> 
> 
> -- 
> Gabor Csardi <address@hidden>     UNIL DGM
> 
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help




reply via email to

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