[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] Edge selection
From: |
Matthew Walker |
Subject: |
[igraph] Edge selection |
Date: |
Thu, 11 Feb 2010 11:36:31 -0500 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090812) |
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] Edge selection,
Matthew Walker <=