get_subgraphs {smallstuff} | R Documentation |
Split a Graph into Subgraphs
Description
Split a graph into subgraphs using the values in a vector to indicate which vertices belong together.
Usage
get_subgraphs(g, split)
Arguments
g |
the graph (an igraph object) |
split |
a vector with a value for each vertex in |
Value
A list of graphs, where each graph is a subgraph of g
containing the vertices with the same value in split
.
Examples
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]])
[Package smallstuff version 1.0.3 Index]