1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{igraph-minus}
\alias{igraph-minus}
\alias{-.igraph}
\title{Delete vertices or edges from a graph}
\usage{
\method{-}{igraph}(e1, e2)
}
\arguments{
\item{e1}{Left argument, see details below.}
\item{e2}{Right argument, see details below.}
}
\value{
An igraph graph.
}
\description{
Delete vertices or edges from a graph
}
\details{
The minus operator (\sQuote{\code{-}}) 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:
\itemize{
\item If it is an igraph graph object, then the difference of the
two graphs is calculated, see \code{\link[=difference]{difference()}}.
\item 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: \preformatted{ g <- make_ring(10)
V(g)$name <- letters[1:10]
g <- g - c("a", "b")}
\item If \code{e2} is a vertex sequence (e.g. created by the
\code{\link[=V]{V()}} function), then these vertices will be deleted from
the graph.
\item If it is an edge sequence (e.g. created by the \code{\link[=E]{E()}}
function), then these edges will be deleted from the graph.
\item If it is an object created with the \code{\link[=vertex]{vertex()}} (or the
\code{\link[=vertices]{vertices()}}) function, then all arguments of \code{\link[=vertices]{vertices()}} are
concatenated and the result is interpreted as a vector of vertex
ids. These vertices will be removed from the graph.
\item If it is an object created with the \code{\link[=edge]{edge()}} (or the
\code{\link[=edges]{edges()}}) function, then all arguments of \code{\link[=edges]{edges()}} are
concatenated and then interpreted as edges to be removed from the
graph.
Example: \preformatted{ 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")}
\item If it is an object created with the \code{\link[=path]{path()}} function,
then all \code{\link[=path]{path()}} arguments are concatenated and then interpreted
as a path along which edges will be removed from the graph.
Example: \preformatted{ g <- make_ring(10)
V(g)$name <- letters[1:10]
g <- g - path("a", "b", "c", "d")}
}
}
\seealso{
Other functions for manipulating graph structure:
\code{\link{+.igraph}()},
\code{\link{add_edges}()},
\code{\link{add_vertices}()},
\code{\link{complementer}()},
\code{\link{compose}()},
\code{\link{connect}()},
\code{\link{contract}()},
\code{\link{delete_edges}()},
\code{\link{delete_vertices}()},
\code{\link{difference}()},
\code{\link{difference.igraph}()},
\code{\link{disjoint_union}()},
\code{\link{edge}()},
\code{\link{intersection}()},
\code{\link{intersection.igraph}()},
\code{\link{path}()},
\code{\link{permute}()},
\code{\link{rep.igraph}()},
\code{\link{reverse_edges}()},
\code{\link{simplify}()},
\code{\link{union}()},
\code{\link{union.igraph}()},
\code{\link{vertex}()}
}
\concept{functions for manipulating graph structure}
|