Use this if you are using igraph from R

Delete vertices or edges from a graph

## S3 method for class 'igraph' e1 - e2

`e1` |
Left argument, see details below. |

`e2` |
Right argument, see details below. |

The minus operator (‘`-`

’) can be used to remove vertices
or edges from the graph. The operation performed is selected based on
the type of the right hand side argument:

If it is an igraph graph object, then the difference of the two graphs is calculated, see

`difference`

.If it is a numeric or character vector, then it is interpreted as a vector of vertex ids and the specified vertices will be deleted from the graph. Example:

g <- make_ring(10) V(g)$name <- letters[1:10] g <- g - c("a", "b")

If

`e2`

is a vertex sequence (e.g. created by the`V`

function), then these vertices will be deleted from the graph.If it is an edge sequence (e.g. created by the

`E`

function), then these edges will be deleted from the graph.If it is an object created with the

`vertex`

(or the`vertices`

) function, then all arguments of`vertices`

are concatenated and the result is interpreted as a vector of vertex ids. These vertices will be removed from the graph.If it is an object created with the

`edge`

(or the`edges`

) function, then all arguments of`edges`

are concatenated and then interpreted as edges to be removed from the graph. Example:g <- make_ring(10) V(g)$name <- letters[1:10] E(g)$name <- LETTERS[1:10] g <- g - edge("e|f") g <- g - edge("H")

If it is an object created with the

`path`

function, then all`path`

arguments are concatenated and then interpreted as a path along which edges will be removed from the graph. Example:g <- make_ring(10) V(g)$name <- letters[1:10] g <- g - path("a", "b", "c", "d")

An igraph graph.

Other functions for manipulating graph structure:
`+.igraph()`

,
`add_edges()`

,
`add_vertices()`

,
`delete_edges()`

,
`delete_vertices()`

,
`edge()`

,
`path()`

,
`vertex()`

[Package *igraph* version 1.3.0 Index]