[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Edge selection
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Edge selection |
Date: |
Thu, 11 Feb 2010 17:39:24 +0100 |
Matthew,
you are completely right, this is a bug. Thanks for reporting it.
Best,
Gabor
On Thu, Feb 11, 2010 at 5:36 PM, Matthew Walker
<address@hidden> wrote:
> Hi,
>
> I've been having a small problem with edge selection. I think there might
> be an issue with the use of the %->% operator when there are no edges that
> match the given specification. I think the following code shows this most
> clearly:
>
>
>> library(igraph)
>> g <- graph( c(0,1, 1,1, 1,2, 2,3, 3,1) )
>> g
> Vertices: 4
> Edges: 5
> Directed: TRUE
> Edges:
> [0] 0 -> 1
> [1] 1 -> 1
> [2] 1 -> 2
> [3] 2 -> 3
> [4] 3 -> 1
>> E(g) [ 0:1 %->% 2:3 ]
> Edge sequence:
> e e [2] 1 -> 2
>> E(g) [ 0:1 %->% 3 ]
> Edge sequence:
> e e [] ->
> Warning message:
> In max(el) : no non-missing arguments to max; returning -Inf
>
>
> However, the "empty edge selector" seems to be fairly functional
> nonetheless:
>
>> E(g)$value <- 1:5
>> E(g) [ 0:1 %->% 2 ]$value
> [1] 3
>> E(g) [ 0:1 %->% 3 ]$value
> integer(0)
>
>
> For both cases, I would have instead expected an "NA" (or similar) response.
> Something along the lines of:
>
>> v <- 1:5
>> v[6]
> [1] NA
>
>
> What do you think of this? Or am I missing something?
>
>
> Cheers,
>
> Matthew
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
--
Gabor Csardi <address@hidden> UNIL DGM