[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] a problem with simplify()
From: |
Simone Gabbriellini |
Subject: |
Re: [igraph] a problem with simplify() |
Date: |
Thu, 21 Oct 2010 19:40:14 +0200 |
with as.vector() both gives me 0-based indexing.
> as.vector(V(g))
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
18 19 20 21 22 23 24 25
[27] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
44 45 46 47 48 49 50 51
> as.vector(E(g))
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
18 19 20
[22] 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
39 40 41
I must have a not so recent 0.6.
best,
simo
Il giorno 21/ott/2010, alle ore 19.34, Gábor Csárdi ha scritto:
> On Thu, Oct 21, 2010 at 7:21 PM, Simone Gabbriellini
> <address@hidden> wrote:
>> Thanks Tamas, Gabor
>>
>> actually, I should have the 1-based vertex indexing. BTW, the edge indexing
>> is 0-based, right?
>
> No. Either both vertex and edge ids are indexed from zero (0.5 branch)
> or both of them are indexed from one (recent 0.6 branch).
>
>>> V(g)
>> Vertex sequence:
>> [1] "user138" "user300" "user301" "user290" "user93" "user145" "user223"
>> "user96" "user148" "user154"
>> [11] "user152" "user467" "user104" "user317" "user111" "user143" "user292"
>> "user91" "user31" "user90"
>
> This is misleading, try
>
> as.vector(V(g))
>
> Gabor
>
>>
>>> E(g)
>> Edge sequence:
>>
>> [0] user85 -> user85
>> [1] user33 -> user33
>>
>>
>> best,
>> simone
>>
>> Il giorno 21/ott/2010, alle ore 19.06, Tamas Nepusz ha scritto:
>>
>>>> Definitely, because your code does not take into account that edges are
>>>> reindexed after every deletion. I'd go for delete.edges(g, seq(0,
>>>> ecount(g)-1)[is.loop(g)])
>>> Or, even better: delete.edges(g, which(is.loop(g))-1) if your igraph
>>> version uses 0-based indexing. Note that the R interface of igraph 0.6 has
>>> recently switched to 1-based indexing, so if you installed igraph 0.6 in
>>> the last few days, you don't have to subtract 1.
>>>
>>> --
>>> T.
>>>
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>> _______________________________________________
>> 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
- [igraph] a problem with simplify(), Simone Gabbriellini, 2010/10/21
- Re: [igraph] a problem with simplify(), Gábor Csárdi, 2010/10/21
- Re: [igraph] a problem with simplify(), Simone Gabbriellini, 2010/10/21
- Re: [igraph] a problem with simplify(), Tamas Nepusz, 2010/10/21
- Re: [igraph] a problem with simplify(), Tamas Nepusz, 2010/10/21
- Re: [igraph] a problem with simplify(), Gábor Csárdi, 2010/10/21
- Re: [igraph] a problem with simplify(), Simone Gabbriellini, 2010/10/21
- Re: [igraph] a problem with simplify(), Gábor Csárdi, 2010/10/21
- Re: [igraph] a problem with simplify(),
Simone Gabbriellini <=