igraph-help
[Top][All Lists]
Advanced

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

[igraph] Get different set of neighbour nodes with very similar code - U


From: Jimmy Dubuisson
Subject: [igraph] Get different set of neighbour nodes with very similar code - Unexpected results
Date: Fri, 06 May 2011 13:42:53 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10

Hello,

I try to get the set of neighbours of a given node (specified by its name) in R. If I do:

vb <- V(g)[V(g)$name == "v2"]
nvb <- V(g)[nei(vb)]
print(nvb$name)

I get the set of node "v2" neighbours as expected. But if I do:

nv <- function(g, id)
{
   vb <- V(g)[V(g)$name == id]
   V(g)[nei(vb)]
}

print(nv(g, "v2")$name)

I get the whole set of g nodes!? Someone could explain why?

Cheers,

Jim.



reply via email to

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