[Top][All Lists]

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

[igraph] Neighors with apply

From: Thomas
Subject: [igraph] Neighors with apply
Date: Wed, 8 Feb 2012 13:45:50 +0000

I have a vector with a list of nodes, which does have NAs in it although they are always at the end of the list, and I'd like to get a list of all the neighbors of those nodes:

dlist <- c(100, 101, 105, NA, NA)

neighbors(g, 100)
neighbors(g, 101)
neighbors(g, 105)

is there any way to do this using an apply function? Something like:

sapply(dlist, function(neighbors) neighbors(g,))
lapply(dlist, neighbors, g)

Thank you!


reply via email to

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