[Top][All Lists]

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

Re: [igraph] neighborhood

From: Khanna, Aditya [MED]
Subject: Re: [igraph] neighborhood
Date: Mon, 21 Mar 2016 00:44:47 +0000

Thanks Tamas! I did it a slightly different way, the default was stored in 
`nei.list`, followed by
        lapply(nei.list, function (x) x[-1])


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Tamas Nepusz
Sent: Sunday, March 20, 2016 3:33 PM
To: Help for igraph users
Subject: Re: [igraph] neighborhood

> 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)) })


igraph-help mailing list

This e-mail is intended only for the use of the individual or entity to which
it is addressed and may contain information that is privileged and confidential.
If the reader of this e-mail message is not the intended recipient, you are 
hereby notified that any dissemination, distribution or copying of this
communication is prohibited. If you have received this e-mail in error, please 
notify the sender and destroy all copies of the transmittal. 

Thank you
University of Chicago Medicine and Biological Sciences 

reply via email to

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