powered by
Split a graph into subgraphs using the values in a vector to indicate which vertices belong together.
get_subgraphs(g, split)
A list of graphs, where each graph is a subgraph of g
g
containing the vertices with the same value in split.
split
the graph (an igraph object)
a vector with a value for each vertex in g
g=igraph::graph_from_literal(1-2,2-3:4,3-4:5:6,5-1) split=c("A","A","B","B","A","B") igraph::V(g);split igraph::V(get_subgraphs(g,split)[[1]]) igraph::V(get_subgraphs(g,split)[[2]])
Run the code above in your browser using DataLab