GraphTheory - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

GraphTheory

  

GraphEqual

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

GraphEqual(G, H)

Parameters

G, H

-

graphs

Description

• 

GraphEqual(G,H) returns true if the two input graphs are equal. Here the graphs are equal if they are (i) both directed or both undirected, (ii) both weighted or both unweighted, (iii) have the same vertex labels and in the same order, (iv) have the same edges. Further, if the graphs are both weighted graphs, their edge weights must be equal and integer edge weights are considered different from floating-point edge weights.

• 

Thus G = Graph([1,2,3],{{1,2},{2,3}}) is considered not equal to H = Graph([1,3,2],{{1,2},{2,3}}) even though their edge sets are the same. If you want to test if the graphs are equal up to a permutation of the vertices then you may compare if their edge sets are equal.

Examples

withGraphTheory:

GGraph1,2,3,1,2,2,3

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

(1)

HGraph1,2,3,1,2,1,3

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

(2)

VerticesG,EdgesG

1,2,3,1,2,2,3

(3)

VerticesH,EdgesH

1,2,3,1,2,1,3

(4)

GraphEqualG,H

false

(5)

HGraphTrail1,2,3

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

(6)

VerticesH,EdgesH

1,2,3,1,2,2,3

(7)

GraphEqualG,H

true

(8)

GGrapha,b,c,a,b,b,c

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

(9)

HPermuteVerticesG,a,c,b

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

(10)

VerticesG,EdgesG

a,b,c,a,b,b,c

(11)

VerticesH,EdgesH

a,c,b,a,b,b,c

(12)

GraphEqualG,H

false

(13)

See Also

Edges

Graph

Trail

Vertices