GraphTheory - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/Contract

GraphTheory

  

Contract

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Contract(G, e, mul)

Parameters

G

-

graph

e

-

edge of the graph

mul

-

(optional) equation of the form multi=true or false

Description

• 

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.

Examples

withGraphTheory:

withSpecialGraphs:

GCompleteGraph4

G:=Graph 1: an undirected unweighted graph with 4 vertices and 6 edge(s)

(1)

ContractG,1,3

Graph 2: an undirected unweighted graph with 3 vertices and 3 edge(s)

(2)

ContractG,1,3,multi=true

Graph 3: an undirected weighted graph with 3 vertices and 3 edge(s)

(3)

PPetersenGraph

P:=Graph 4: an undirected unweighted graph with 10 vertices and 15 edge(s)

(4)

DrawGraphP

Contract the five edges connecting the inner star to the outer pentagon to show K5.

GfoldlContract,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)

(5)

NumberOfVerticesG

5

(6)

IsCliqueG

true

(7)

See Also

DeleteEdge

DeleteVertex

foldl

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam