GraphTheory

Parameters

 G - graph V - vertex or list of vertices

Description

 • The AddVertex command adds a vertex or vertices to a graph. A new graph is returned which contains the specified set of vertices in addition to the vertices in the original graph G.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{CycleGraph}\left(5\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 5 vertices and 5 edge\left(s\right)}}$ (1)
 > $\mathrm{AddVertex}\left(G,\left["a","b"\right]\right)$
 ${\mathrm{Graph 2: an undirected unweighted graph with 7 vertices and 5 edge\left(s\right)}}$ (2)
 > $\mathrm{AddVertex}\left(G,4\right)$