next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Graphs :: addVertex

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

Synopsis

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

Ways to use addVertex :

For the programmer

The object addVertex is a method function.