VertexContract[g,{v1,v2,…}]
contracts a collection of vertices v1, v2, … into a single vertex of the graph g.
VertexContract[g,{{v1,v2,…},…}]
contracts several collections of vertices.
VertexContract[{vw,…},…]
uses rules vw to specify the graph g.


VertexContract
VertexContract[g,{v1,v2,…}]
contracts a collection of vertices v1, v2, … into a single vertex of the graph g.
VertexContract[g,{{v1,v2,…},…}]
contracts several collections of vertices.
VertexContract[{vw,…},…]
uses rules vw to specify the graph g.
Details and Options

- VertexContract is also known as vertex identification.
- VertexContract[g,{v1,v2,…}] creates a new graph from g by removing all edges between vi and vj and merging them into the single vertex v1.
- VertexContract works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

Examples
open all close allScope (7)
VertexContract works with undirected graphs:
Use rules to specify the graph:
Use patterns to specify a set of vertices:
VertexContract works with large graphs:
Applications (2)
Properties & Relations (2)
Related Guides
Text
Wolfram Research (2014), VertexContract, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexContract.html (updated 2015).
CMS
Wolfram Language. 2014. "VertexContract." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexContract.html.
APA
Wolfram Language. (2014). VertexContract. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexContract.html
BibTeX
@misc{reference.wolfram_2025_vertexcontract, author="Wolfram Research", title="{VertexContract}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexContract.html}", note=[Accessed: 14-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_vertexcontract, organization={Wolfram Research}, title={VertexContract}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexContract.html}, note=[Accessed: 14-August-2025]}