[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] delete connected vertices of to-be-deleted vertices
From: |
Cesar Caballero |
Subject: |
Re: [igraph] delete connected vertices of to-be-deleted vertices |
Date: |
Fri, 30 Oct 2015 00:58:27 +0100 (CET) |
Thanks very much.
Cesar
----------------------------------------------------------------------
Cesar Caballero
MRI engineer
www.bcbl.eu
Twitter: @caballerogaudes
www.researchgate.net/profile/Cesar_Caballero2
Legal disclaimer/Aviso legal/Lege-oharra: www.bcbl.eu/legal-disclaimer
----- Original Message -----
From: "Tamas Nepusz" <address@hidden>
To: "igraph-help" <address@hidden>
Sent: Thursday, October 29, 2015 10:47:38 PM
Subject: Re: [igraph] delete connected vertices of to-be-deleted vertices
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.
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help