Delete vertices or edges from a graph
Details
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:
If
e2
is a vertex sequence (e.g. created by theV()
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 thevertices()
) function, then all arguments ofvertices()
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 theedges()
) function, then all arguments ofedges()
are concatenated and then interpreted as edges to be removed from the graph. Example:If it is an object created with the
path()
function, then allpath()
arguments are concatenated and then interpreted as a path along which edges will be removed from the graph. Example:
See also
Other functions for manipulating graph structure:
+.igraph()
,
add_edges()
,
add_vertices()
,
complementer()
,
compose()
,
connect()
,
contract()
,
delete_edges()
,
delete_vertices()
,
difference()
,
difference.igraph()
,
disjoint_union()
,
edge()
,
intersection()
,
intersection.igraph()
,
path()
,
permute()
,
rep.igraph()
,
reverse_edges()
,
simplify()
,
union()
,
union.igraph()
,
vertex()