VertexAdd

VertexAdd[g,v]

makes a graph by adding the vertex v to the graph g.

VertexAdd[g,{v1,v2,}]

adds a collection of vertices to g.

VertexAdd[{vw,},]

uses rules vw to specify the graph g.

Details

  • VertexAdd[g,v] will add the vertex v only if it does not already exist in g.
  • VertexAdd works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

Examples

open allclose all

Basic Examples  (1)

Add a vertex to a complete graph:

In[1]:=
Click for copyable input
Out[1]=

Scope  (7)

Properties & Relations  (2)

See Also

VertexDelete  EdgeAdd

Introduced in 2010
(8.0)
| Updated in 2015
(10.3)