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

  • 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 allclose all

Basic Examples  (1)

Contract vertices of a graph:

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

Scope  (7)

Applications  (2)

Properties & Relations  (2)

See Also

EdgeContract  VertexReplace  VertexAdd  VertexDelete  EdgeAdd  EdgeDelete

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