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:

Wolfram Research (2010), VertexAdd, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexAdd.html (updated 2015).

Text

Wolfram Research (2010), VertexAdd, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexAdd.html (updated 2015).

BibTeX

@misc{reference.wolfram_2021_vertexadd, author="Wolfram Research", title="{VertexAdd}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexAdd.html}", note=[Accessed: 27-July-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_vertexadd, organization={Wolfram Research}, title={VertexAdd}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexAdd.html}, note=[Accessed: 27-July-2021 ]}

CMS

Wolfram Language. 2010. "VertexAdd." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexAdd.html.

APA

Wolfram Language. (2010). VertexAdd. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexAdd.html