I'm working with a directed network in igraph. Here's some code to generate such a network:
# example graph
# install.packages(c("igraph"), dependencies = TRUE)
library(igraph)
set.seed(1)
g <- erdos.renyi.game(20, 1/20,directed=TRUE,loops=FALSE)
V(g)$name <- letters[1:20]
par(mar=rep(0,4))
plot(g)
I would like to extract subsets of this network that include an arbitrary vertex and all edges and vertices that direct to this vertex, regardless of the degree or distance of that connection.
Here's a photoshopped example of what I would like to extract, using vertex "E" in this case. I would like to extract a network that includes all vertices labeled in blue and connected edges.