DeleteVertex - Maple Help

GraphTheory

 DeleteVertex
 delete vertex from graph

 Calling Sequence DeleteVertex(G, V)

Parameters

 G - graph V - vertex or a list or set of vertices

Description

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{CycleGraph}\left(5\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected graph with 5 vertices and 5 edge\left(s\right)}}$ (1)
 > $H≔\mathrm{DeleteVertex}\left(G,\left[1,4\right]\right)$
 ${H}{≔}{\mathrm{Graph 2: an undirected graph with 3 vertices and 1 edge\left(s\right)}}$ (2)
 > $\mathrm{Edges}\left(H\right)$
 $\left\{\left\{{2}{,}{3}\right\}\right\}$ (3)
 > $J≔\mathrm{InducedSubgraph}\left(G,\left\{2,3,5\right\}\right)$
 ${J}{≔}{\mathrm{Graph 3: an undirected graph with 3 vertices and 1 edge\left(s\right)}}$ (4)
 > $\mathrm{Edges}\left(J\right)$
 $\left\{\left\{{2}{,}{3}\right\}\right\}$ (5)

The next example raises an error because graph $G$ only has five vertices.

 > $\mathrm{DeleteVertex}\left(G,6\right)$