GraphEqual - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


GraphTheory

  

GraphEqual

  

test graphs for equality

 

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.

• 

For a more general test for graph isomorphism, see GraphTheory[IsIsomorphic].

Examples

withGraphTheory:

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

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

(1)

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

HGraph 2: an undirected 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 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 graph with 3 vertices and 2 edge(s)

(9)

HPermuteVerticesG,a,c,b

HGraph 5: an undirected 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

IsIsomorphic

Trail

Vertices