[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] neighbors
From: |
harun pirim |
Subject: |
Re: [igraph] neighbors |
Date: |
Tue, 2 Nov 2010 08:51:19 -0500 |
Thanks, you are right. I simplified the graph then.
HP
On Nov 2, 2010, at 6:12 AM, Gábor Csárdi wrote:
> Hi,
>
> On Tue, Nov 2, 2010 at 4:52 AM, harun pirim <address@hidden> wrote:
>> Hi All,
>>
>> I see an interesting problem using neighbors() function. I have an
>> undirected graph g2 with 90 vertices.
>>
>> Here is how neighbors() works:
>>
>> neighbors(g2,2)
>> [1] 0 2 2 14 32 42 64 68 69 71 72 74 96
>>
>>
>> neighbors(g2,3)
>> [1] 3 3 5 8 12 19 20 22 23 26 29 30 41 45 53 57 77 78 79 80 81 82 83 84
>> 85 86 87
>> [28] 88 89 90 92 93 94 95
>>
>>
>> neighbors(g2,4)
>> [1] 4 4 6 10 13 14 15 16 17 18 24 25 27 34 35 39 46 47 48 50 54 55 56 59
>> 60 66 68
>> [28] 70 71 72 74
>>
>> Basicly, output includes the node itself. and twice. Do you have any idea
>> why it does so?
>
> Because you have loop edges in your graph. For a single 'v-v' loop
> edge 'v' appears twice in the output of neighbors, for consistency.
> (Otherwise the degree of the vertex would not match the length of the
> neighbors() vector.)
>
> Gabor
>
>> Thank you,
>>
>>
>> Harun Pirim
>> _______________________________________________
>> 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