Skip to content

Chapter 15. Graph Isomorphism

Two graphs may look different when drawn, yet represent the same abstract structure. Graph theory studies adjacency relations, not geometric appearance or vertex labels. The concept that captures structural sameness is graph isomorphism.

An isomorphism is a relabeling of vertices that preserves adjacency. If two graphs are isomorphic, they differ only in presentation. They are considered the same graph from the structural viewpoint of graph theory. Standard definitions describe graph isomorphism as a bijection preserving adjacency relations. (en.wikipedia.org)

15.1 Definition of Graph Isomorphism

Let

G=(VG,EG) G=(V_G,E_G)

and

H=(VH,EH) H=(V_H,E_H)

be graphs.

An isomorphism from GG to HH is a bijection

f:VGVH f:V_G\to V_H

such that for all vertices

u,vVG, u,v\in V_G,

we have

{u,v}EG{f(u),f(v)}EH. \{u,v\}\in E_G \quad\Longleftrightarrow\quad \{f(u),f(v)\}\in E_H.

Thus adjacency is preserved exactly.

If such a bijection exists, the graphs are isomorphic, written

GH. G\cong H.

If no such bijection exists, the graphs are non-isomorphic.

The condition must preserve both edges and non-edges. Adjacent vertices must map to adjacent vertices, and nonadjacent vertices must map to nonadjacent vertices.

15.2 Structural Interpretation

An isomorphism changes names but not structure.

Suppose

G G

has vertices

{a,b,c,d} \{a,b,c,d\}

and edges

{{a,b},{b,c},{c,d}}. \{\{a,b\},\{b,c\},\{c,d\}\}.

Suppose

H H

has vertices

{1,2,3,4} \{1,2,3,4\}

and edges

{{1,2},{2,3},{3,4}}. \{\{1,2\},\{2,3\},\{3,4\}\}.

The mapping

a1,b2,c3,d4 a\mapsto 1, \qquad b\mapsto 2, \qquad c\mapsto 3, \qquad d\mapsto 4

preserves adjacency. Therefore

GH. G\cong H.

Both graphs are simply paths on four vertices.

A graph drawing may stretch, rotate, bend, or reorder vertices. None of these changes affect isomorphism.

15.3 Non-Isomorphic Graphs

Two graphs are not isomorphic if no adjacency-preserving bijection exists.

Often this can be shown using graph invariants.

For example, suppose GG has degree sequence

(3,2,2,1) (3,2,2,1)

while HH has degree sequence

(2,2,2,2). (2,2,2,2).

Since degree sequence is preserved by isomorphism, the graphs cannot be isomorphic.

Thus

G≇H. G\not\cong H.

Differences in order, size, degree sequence, component count, diameter, cycle structure, chromatic number, or other invariants can all prove non-isomorphism.

15.4 Isomorphism as an Equivalence Relation

Graph isomorphism is an equivalence relation.

Reflexivity

Every graph is isomorphic to itself. The identity map

f(v)=v f(v)=v

preserves adjacency.

Thus

GG. G\cong G.

Symmetry

If

GH, G\cong H,

then

HG. H\cong G.

The inverse of an isomorphism is also an isomorphism.

Transitivity

If

GH G\cong H

and

HK, H\cong K,

then

GK. G\cong K.

The composition of two isomorphisms is an isomorphism.

Therefore isomorphism partitions graphs into equivalence classes of structurally identical graphs.

15.5 Preserved Quantities

Any graph invariant is preserved under isomorphism.

If

GH, G\cong H,

then:

QuantityPreserved?
Number of verticesYes
Number of edgesYes
Degree sequenceYes
Number of componentsYes
DiameterYes
GirthYes
Chromatic numberYes
Clique numberYes
PlanarityYes
BipartitenessYes

Thus invariants are necessary conditions for isomorphism.

However, equality of invariants is usually not sufficient.

15.6 Adjacency Matrix View

Two graphs are isomorphic if and only if their adjacency matrices differ only by simultaneous permutation of rows and columns.

Let

A(G) A(G)

and

A(H) A(H)

be adjacency matrices.

If

GH, G\cong H,

then there exists a permutation matrix PP such that

A(H)=P1A(G)P. A(H)=P^{-1}A(G)P.

The permutation matrix reorders the vertices.

Thus isomorphism corresponds to relabeling rows and columns consistently. This matrix characterization is standard in algebraic graph theory. (mathworld.wolfram.com)

15.7 Automorphisms

An automorphism of a graph GG is an isomorphism from GG to itself.

Thus an automorphism is a permutation of the vertices that preserves adjacency.

The set of automorphisms of GG forms a group under composition, called the automorphism group of GG.

Automorphisms describe graph symmetries.

For example:

GraphAutomorphism behavior
KnK_nAny vertex permutation works
Cycle CnC_nRotations and reflections
Path PnP_nReflection symmetry only
Generic asymmetric graphIdentity only

Automorphisms connect graph theory with group theory and symmetry.

15.8 Labeled and Unlabeled Graphs

A labeled graph treats vertex names as meaningful.

An unlabeled graph treats only structure as meaningful.

Two labeled graphs may be different as labeled objects even when they are isomorphic as unlabeled graphs.

For example:

Graph A: a-b-c
Graph B: 1-2-3

These are different labeled graphs but the same unlabeled graph structure.

Enumeration problems often distinguish between labeled and unlabeled counting.

15.9 Canonical Forms

A canonical form assigns a unique representation to each isomorphism class.

If two graphs have the same canonical form, they are isomorphic.

For example, one may reorder vertices according to a deterministic rule and choose the lexicographically smallest adjacency matrix among all labelings.

Canonical forms are important in:

AreaUse
Chemical graph theoryMolecule comparison
DatabasesDuplicate structure detection
Model checkingState compression
Network analysisPattern matching

Efficient canonicalization is closely related to the graph isomorphism problem.

15.10 The Graph Isomorphism Problem

The graph isomorphism problem asks:

Given graphs GG and HH, determine whether

>GH.> > G\cong H. >

This is one of the major computational problems in discrete mathematics and theoretical computer science.

No polynomial-time algorithm is known for the general problem, but the problem is also not known to be NP-complete. In 2015, László Babai announced a quasipolynomial-time algorithm for graph isomorphism. (en.wikipedia.org)

Many important graph classes admit efficient isomorphism algorithms, including:

Graph classComplexity
TreesPolynomial time
Planar graphsPolynomial time
Graphs of bounded degreePolynomial time
General graphsQuasipolynomial known

The graph isomorphism problem sits in a special position in complexity theory.

15.11 Isomorphism of Trees

Trees have particularly structured isomorphism behavior.

Two rooted trees are isomorphic if there exists a root-preserving adjacency-preserving bijection.

Tree isomorphism can be solved efficiently by recursively comparing subtree structure.

For example, two rooted trees are isomorphic when:

  1. Their roots have the same number of children.
  2. Corresponding child subtrees are recursively isomorphic.

Tree isomorphism algorithms are much easier than general graph isomorphism because trees contain no cycles.

15.12 Isomorphic Subgraphs

A graph GG contains a copy of a graph HH if some subgraph of GG is isomorphic to HH.

For example, GG contains a triangle if it contains a subgraph isomorphic to

K3. K_3.

Subgraph isomorphism differs from graph isomorphism.

ProblemQuestion
Graph isomorphismAre the entire graphs structurally identical?
Subgraph isomorphismDoes one graph contain a copy of the other?

Subgraph isomorphism is generally harder computationally.

15.13 Isomorphism and Complements

Complementation preserves isomorphism.

If

GH, G\cong H,

then

GH. \overline{G}\cong \overline{H}.

An adjacency-preserving bijection automatically preserves non-adjacency.

Thus complement graphs belong to corresponding isomorphism classes.

15.14 Self-Isomorphic Structures

Some graphs are isomorphic to their own complement.

Such graphs are called self-complementary.

Examples include:

GraphSelf-complementary?
P4P_4Yes
C5C_5Yes
KnK_nNo for n>1n>1
Empty graphNo for n>1n>1

Self-complementary graphs illustrate how different-looking adjacency descriptions can encode the same structure after relabeling.

15.15 Counting Non-Isomorphic Graphs

The number of unlabeled graphs on nn vertices is the number of isomorphism classes of labeled graphs.

For small nn:

nnNumber of non-isomorphic simple graphs
11
22
34
411
534

The number grows rapidly.

Counting unlabeled graphs is substantially harder than counting labeled graphs because one must factor out isomorphisms.

15.16 Distinguishing Graphs

To test whether two graphs are isomorphic, one typically proceeds through increasingly refined invariants.

Common checks include:

  1. Compare order.
  2. Compare size.
  3. Compare degree sequence.
  4. Compare component structure.
  5. Compare cycle counts.
  6. Compare spectra.
  7. Attempt explicit bijection construction.

Failure at any step proves non-isomorphism.

Agreement does not prove isomorphism unless a full adjacency-preserving bijection is found.

15.17 Example

Let

G G

have vertices

{a,b,c,d} \{a,b,c,d\}

and edges

{{a,b},{b,c},{c,d},{d,a}}. \{\{a,b\},\{b,c\},\{c,d\},\{d,a\}\}.

Let

H H

have vertices

{1,2,3,4} \{1,2,3,4\}

and edges

{{1,2},{2,4},{4,3},{3,1}}. \{\{1,2\},\{2,4\},\{4,3\},\{3,1\}\}.

Both graphs are cycles of length 44.

Define

f(a)=1,f(b)=2,f(c)=4,f(d)=3. f(a)=1, \qquad f(b)=2, \qquad f(c)=4, \qquad f(d)=3.

Then:

{a,b}{1,2}, \{a,b\}\mapsto \{1,2\}, {b,c}{2,4}, \{b,c\}\mapsto \{2,4\}, {c,d}{4,3}, \{c,d\}\mapsto \{4,3\}, {d,a}{3,1}. \{d,a\}\mapsto \{3,1\}.

All adjacencies are preserved.

Therefore

GH. G\cong H.

The drawings may look different, but the graphs have identical cycle structure.

15.18 Example of Non-Isomorphism

Let GG and HH both have:

V=6,E=6. |V|=6, \qquad |E|=6.

Suppose:

  • G=C6G=C_6.
  • H=C3C3H=C_3\cup C_3.

Both graphs have degree sequence

(2,2,2,2,2,2). (2,2,2,2,2,2).

However:

c(G)=1,c(H)=2. c(G)=1, \qquad c(H)=2.

Since the number of connected components differs,

G≇H. G\not\cong H.

This example shows that several invariants may agree before one finally distinguishes the graphs.

15.19 Summary

Graph isomorphism formalizes structural equality of graphs. Two graphs are isomorphic when there exists a bijection between their vertex sets that preserves adjacency.

Isomorphism is an equivalence relation. Graph invariants are preserved under isomorphism and are useful for disproving isomorphism. However, equal invariants generally do not prove isomorphism.

Automorphisms describe graph symmetries. Canonical forms attempt to represent each isomorphism class uniquely. The graph isomorphism problem asks whether two graphs are structurally identical and remains one of the central algorithmic problems in graph theory and theoretical computer science.