delete_vertices: Delete vertices from a graph

Description Usage Arguments Value See Also Examples

View source: R/interface.R

Description

Delete vertices from a graph

Usage

1

Arguments

graph

The input graph.

v

The vertices to remove, a vertex sequence.

Value

The graph, with the vertices removed.

See Also

Other functions for manipulating graph structure: +.igraph(), add_edges(), add_vertices(), delete_edges(), edge(), igraph-minus, path(), vertex()

Examples

1
2
3
4
5
6
7
8
9
g <- make_ring(10) %>%
  set_vertex_attr("name", value = LETTERS[1:10])
g
V(g)

g2 <- delete_vertices(g, c(1,5)) %>%
  delete_vertices("B")
g2
V(g2)

Example output

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

IGRAPH d0066c0 UN-- 10 10 -- Ring graph
+ attr: name (g/c), mutual (g/l), circular (g/l), name (v/c)
+ edges from d0066c0 (vertex names):
 [1] A--B B--C C--D D--E E--F F--G G--H H--I I--J A--J
+ 10/10 vertices, named, from d0066c0:
 [1] A B C D E F G H I J
IGRAPH 0800000 UN-- 7 5 -- Ring graph
+ attr: name (g/c), mutual (g/l), circular (g/l), name (v/c)
+ edges from 0800000 (vertex names):
[1] C--D F--G G--H H--I I--J
+ 7/7 vertices, named, from 0800000:
[1] C D F G H I J

igraph documentation built on March 19, 2020, 5:13 p.m.