# addVertex -- A method for adding a set of vertices to a graph

## Synopsis

• Usage:
H = addVertex (G, v)
H = addVertices (G, L)
• Inputs:
• G, an instance of the type Graph,
• L, a list, list of the names of the new vertices
• v, , name of the new vertex
• Outputs:
• H, an instance of the type Graph, This is the graph with the additional vertices specified in L

## Description

This method will add vertices (as singletons) to any already present graph. Note that if you add a vertex that is already in the vertex set of the input graph, that vertex will be ignored.

 i1 : G = completeGraph 4 o1 = Graph{0 => {1, 2, 3}} 1 => {0, 2, 3} 2 => {0, 1, 3} 3 => {0, 1, 2} o1 : Graph i2 : H = addVertices(G, {3,4,5}) o2 = Graph{0 => {1, 2, 3}} 1 => {0, 2, 3} 2 => {0, 1, 3} 3 => {0, 1, 2} 4 => {} 5 => {} o2 : Graph

## See also

• addEdges' -- A method for adding edges to a graph

## Ways to use addVertex :

• "addVertex(Digraph,Thing)"

## For the programmer

The object addVertex is .