igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] delete connected vertices of to-be-deleted vertices


From: Tamas Nepusz
Subject: Re: [igraph] delete connected vertices of to-be-deleted vertices
Date: Thu, 29 Oct 2015 23:47:38 +0100

Hi Cesar,

> But, does this step ALSO remove THEIR CONNECTED VERTICES?
No - quite unsurprisingly, delete.vertices() will delete only those
vertices that you specify explicitly.

> If not, how can I achieve this?
Use the ego() function to extract the list of vertices that are at
most a given number of steps to a given seed vertex, followed by
unlist() and unique():

vs <- c(1,2,3,4)
unique(unlist(ego(g, 1, vs)))

This gives you a numeric vector that contains the seed vertices (in
vs) and all the vertices that are neighbors of at least one seed
vertex.

T.



reply via email to

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