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 and Options

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

Scope  (7)

VertexAdd works with undirected graphs:

Directed graphs:

Multigraphs:

Mixed graphs:

Add a set of vertices to the graph:

Use rules to specify the graph:

VertexAdd works with large graphs:

Properties & Relations  (2)

VertexAdd does not change the EdgeList:

The number of vertices can be found using VertexCount:

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