Suppose I have a graph like this:
library(igraph)
gtest <- graph(c(1,2,1,3,2,3,3,4), directed = FALSE)
Now, I want the induced subgraph from gtest with nodes 1, 3, 4. When I run the following command, it seems that is generating a new graph, with 3 nodes 1, 2, and 3.
induced.subgraph(graph = gtest,vids = c(1,3,4), impl = "copy_and_delete")
IGRAPH 17d00a4 U--- 3 2 --
+ edges from 17d00a4: [1] 1--2 2--3
But I need to keep the node name/id. Is there any solution for this?