delete vertex from graph
vertex or a list or set of vertices
The DeleteVertex command returns a copy of the graph G with the specified vertex, or list of vertices, deleted. The graph G is not changed. The resulting graph is the subgraph of G induced by the remaining vertices. Any edges adjacent to V are removed.
G ≔ CycleGraph⁡5
G≔Graph 1: an undirected graph with 5 vertices and 5 edge(s)
H ≔ DeleteVertex⁡G,1,4
H≔Graph 2: an undirected graph with 3 vertices and 1 edge(s)
J ≔ InducedSubgraph⁡G,2,3,5
J≔Graph 3: an undirected graph with 3 vertices and 1 edge(s)
The next example raises an error because graph G only has five vertices.
Error, (in GraphTheory:-DeleteVertex) second argument expected to be a vertex or a list of vertices of the graph
Download Help Document