Building off this question here, is there a way to extend this subgraph to include vertices connected by two degrees to a subset of vertices? I'm thinking of a command similar to the functions in make_ego_graph() where order=2 and mode="in". I'm working with a directed graph object.
Thus far, I've come up with the following, but it's not producing the graph I'm looking for.
first_degree <- V(graph)$condition == "something"
second_degree <- V(graph)[to(first_degree)]
edges_subset <- E(graph)[to(first_degree) | to(second_degree)]
desired_subset <- subgraph.edges(graph, edges_subset)
Thanks for any advice you can give me!