Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

igraph (version 0.1.1)

subgraph: Subgraph of a graph

Description

subgraph creates a subgraph of a graph, containing only the specified vertices and all the edges among them.

Usage

subgraph(graph, v)

Arguments

graph
The original graph.
v
Numeric vector, the vertices of the original graph which will form the subgraph.

Value

  • A new graph object.

Details

The ids of the vertices will change in the subgraph of course since these are always consecutive.

Examples

Run this code
g <- graph.ring(10)
g2 <- subgraph(g, 1:7)

Run the code above in your browser using DataLab