| igraph Reference Manual |
|---|
int igraph_subgraph(const igraph_t *graph, igraph_t *res, const igraph_vs_t vids);
This function collects the specified vertices and all edges between them to a new graph. As the vertex ids in a graph always start with one, this function very likely needs to reassign ids to the vertices.
Arguments:
|
The graph object. |
|
The subgraph, another graph object will be stored here,
do not initialize this object before calling this
function, and call |
|
Vector with the vertex ids to put in the subgraph. |
Returns:
Error code:
|
Time complexity: O(|V|+|E|), |V| and |E| are the number of vertices and edges in the original graph.
See also:
|
<< 4.1. igraph_subcomponent — The vertices in the same component as a given vertex. |
4.3. igraph_clusters — Calculates the (weakly or strongly) connected components in a graph. >> |