Contract(G, e, mul)
edge of the graph
(optional) equation of the form multi=true or false
The Contract command contracts the specified edge of a graph. By default, all the loops and multiple edges are removed. By setting multi=true, the loops and multiple edges are preserved and the output is a weighted graph.
To contract multiple edges in a graph, use the foldl command.
G ≔ CompleteGraph⁡4
G ≔ Graph 1: an undirected unweighted graph with 4 vertices and 6 edge(s)
Graph 2: an undirected unweighted graph with 3 vertices and 3 edge(s)
Graph 3: an undirected weighted graph with 3 vertices and 3 edge(s)
P ≔ PetersenGraph⁡
P ≔ Graph 4: an undirected unweighted graph with 10 vertices and 15 edge(s)
Contract the five edges connecting the inner star to the outer pentagon to show K5.
G ≔ foldl⁡Contract,P,1,6,2,9,3,7,4,10,5,8
G ≔ Graph 5: an undirected unweighted graph with 5 vertices and 10 edge(s)
Download Help Document
What kind of issue would you like to report? (Optional)
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.