[Top][All Lists]

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

Re: [igraph] neighborhood

From: Tamas Nepusz
Subject: Re: [igraph] neighborhood
Date: Sun, 20 Mar 2016 21:32:41 +0100

> I am using igraph in R to compute the neighborhood (order 1, i.e. direct
> links) of vertices in a graph. By default, the return values contain the
> seed vertex (i.e. neighbor of order 0). Is there an way to only get the
> order 1 neighbors?
How about this:

> g <- make_ring(10)        # just to have an example graph
> induced_subgraph(g, neighbors(g, 2))

If you need it for more than one vertex:

> lapply(c(2,3,4), function(x) { induced_subgraph(g, neighbors(g, x)) })


reply via email to

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