# subgraph

From igraph v0.6.5-2
by Gabor Csardi

##### Subgraph of a graph

`subgraph`

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

- Keywords
- graphs

##### Usage

```
induced.subgraph(graph, vids, impl=c("auto", "copy_and_delete",
"create_from_scratch"))
subgraph.edges(graph, eids, delete.vertices = TRUE)
subgraph(graph, v)
```

##### Arguments

- graph
- The original graph.
- vids,v
- Numeric vector, the vertices of the original graph which will form the subgraph.
- impl
- Character scalar, to choose between two
implementation of the subgraph
calculation.
copies the graph first, and then deletes the vertices and edges that are not included in the result graph. <`copy_and_delete`

- eids
- The edge ids of the edges that will be kept in the result graph.
- delete.vertices
- Logical scalar, whether to remove vertices
that do not have any adjacent edges in
`eids`

.

##### Details

`induced.subgraph`

calculates the induced subgraph of a set of
vertices in a graph. This means that exactly the specified vertices
and all the edges between then will be kept in the result graph.

`subgraph.edges`

calculates the subgraph of a graph. For this
function one can specify the vertices and edges to keep. This
function will be renamed to `subgraph`

in the next major
version of igraph.

The `subgraph`

function does the same as `induced.graph`

currently (assuming `auto`

`impl`

argument), but it is deprecated and will be removed in the next
major version of igraph.

##### Value

- A new graph object.

##### concept

Subgraph

##### Examples

```
g <- graph.ring(10)
g2 <- induced.subgraph(g, 1:7)
g3 <- subgraph.edges(g, 1:5, 1:5)
```

*Documentation reproduced from package igraph, version 0.6.5-2, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.