You are on page 1of 188

MATH140

GRAPH THEORY
OBJECTIVES
 At the end of the lecture, the student must
be able to:
 Understand graph theory which includes
paths and cycles.
 Represent graphs through adjacency
matrices.
 Identify the isomorphism of graphs.
 Identify and characterize trees.
GRAPH THEORY
 HISTORY:

 Konigsberg Bridge
 Konigsberg is a city which was the capital of East
Prussia but now is known as Kaliningrad in Russia.
 People tried to find a way to walk all seven bridges
without crossing a bridge twice. Can you find one?
GRAPH THEORY
 From landmass and bridges to points and
edges:
GRAPH THEORY
 Konigsberg Bridge:
 Can we walk through town, crossing each bridge
exactly once, and return to start?

The original problem Equivalent multigraph


GRAPH THEORY
 Agenda:
 Graph basics and definitions
 Vertices/nodes, edges, adjacency,
incidence
 Degree, in-degree, out-degree
 Subgraphs, unions, isomorphism
 Adjacency matrices
GRAPH THEORY
 Agenda:
 Types of Graphs
 Simple graphs, Undirected graphs
 Multigraphs, Pseudographs
 Digraphs, Directed multigraphs
 Bipartite graphs
 Complete graphs, cycles, wheels, cubes,
complete bipartite
 Trees
GRAPH THEORY
 Applications of Graphs:
 Applications of Graphs: Potentially anything (graphs
can represent relations, relations can describe the
extension of any predicate).
 Applications in networking, scheduling, flow
optimization, circuit design, path planning, Car
navigation system.
 More applications: Geneology analysis, computer
game-playing, program compilation, object-oriented
design, …
GRAPH THEORY
 Graphs –Intuitive Notion:
 A graph is a bunch of vertices (or nodes)
represented by circles which are
connected by edges, represented by line
segments .

 Mathematically, graphs are binary-relations


on their vertex set.
GRAPH THEORY
 Example:
 Different purposes require different types of
graphs. Suppose a local computer network.
 Is bidirectional (undirected)
 Has no loops (no “self-communication”)
 Has unique connections between computers
{1,2}
1 2

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


{3,4}
3 4

{1,4}
GRAPH THEORY
 Example:
{1,2}
1 2

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


{3,4}
3 4

{1,4}

 Sensible to represent as follows:


 Vertices are labeled to associate with particular
computers.
 Each edge can be viewed as the set of its two
endpoints.
GRAPH THEORY
 SIMPLE GRAPHS:
 A simple graph G = (V,E ) consists of a non-empty set
V of vertices (or nodes) and a set E (possibly empty)
of edges where each edge is a subset of V with
cardinality 2 (an unordered pair).
GRAPH THEORY
 QUESTION:
 For a set V with n elements, how many possible
edges there?

 ANSWER:
 The number of pairs in V
= C (n,2) = n · (n -1) / 2
GRAPH THEORY
 QUESTION:
 How many possible graphs are there for the
same set of vertices V ?

 ANSWER:
 The number of subsets in the set of possible
edges. There are n · (n -1) / 2 possible edges,
therefore the number of graphs on V is 2n(n -1)/2
GRAPH THEORY
 MULTIGRAPH:
 If computers are connected via internet
instead of directly, there may be several routes
to choose from for each connection.
 Depending on traffic, one route could be better
than another.
 Makes sense to allow multiple edges, but still no
self-loops:
GRAPH THEORY
 MULTIGRAPH:
e1
1 e2 2

e3 e4 e5
3 e6 4

 Edge-labels distinguish between edges sharing


same endpoints.
 Labeling can be thought of as function:
 e1  {1,2}, e2  {1,2}, e3  {1,3},
 e4  {2,3}, e5  {2,3}, e6  {1,2}
GRAPH THEORY
 MULTIGRAPH:
 A multigraph G = (V,E,f ) consists of a non-
empty set V of vertices (or nodes), a set E
(possibly empty) of edges and a function f
with domain E and codomain the set of pairs in
V.
GRAPH THEORY
 PSEUDOGRAPH:
 If self-loops are allowed we get a pseudograph:

e1 e6
1 e2 2

e3 e4 e5 e7
3 4
 Now edges may be associated with a single
vertex, when the edge is a loop.
 e1  {1,2}, e2  {1,2}, e3  {1,3},
 e4  {2,3}, e5  {2}, e6  {2}, e7  {4}
GRAPH THEORY
 PSEUDOGRAPH:
 A pseudograph G = (V,E,f ) consists of a non-
empty set V of vertices (or nodes), a set E
(possibly empty) of edges and a function f
with domain E and codomain the set of pairs
and singletons in V.
GRAPH THEORY
 UNDIRECTED GRAPHS TERMINOLOGY:
 The order of a graph is the number of its
vertices, i.e. |V(G)|.
 The size of a graph is the number of its
edges, i.e. |E(G)|.[

 QUESTION: What is the order and the size


of the graph?
GRAPH THEORY
 UNDIRECTED GRAPHS TERMINOLOGY:
 Vertices are adjacent if they are the
endpoints of the same edge.
e1
1 e2 2

e3 e4 e5
3 e6 4

 QUESTION: Which vertices are adjacent to


1? How about adjacent to 2, 3, and 4?
GRAPH THEORY
 UNDIRECTED GRAPHS TERMINOLOGY:
 ANSWER:
e1
1 e2 2

e3 e4 e5
3 e6 4

 1 is adjacent to 2 and 3
 2 is adjacent to 1 and 3
 3 is adjacent to 1 and 2
 4 is not adjacent to any vertex
GRAPH THEORY
 UNDIRECTED GRAPHS TERMINOLOGY:
 A vertex is incident with an edge (and the edge
is incident with the vertex) if it is the endpoint
of the edge..
e1
1 e2 2

e3 e4 e5
3 e6 4

 QUESTION: Which edges are incident to 1?


How about incident to 2, 3, and 4?
GRAPH THEORY
 UNDIRECTED GRAPHS TERMINOLOGY:
 ANSWER:
e1
1 e2 2

e3 e4 e5
3 e6 4

 e1, e2, e3, e6 are incident with 1


 2 is incident with e1, e2, e4, e5, e6
 3 is incident with e3, e4, e5
 4 is not incident with any edge
GRAPH THEORY
 DIGRAPH:
 Last time introduced digraphs as a way of
representing relations:

1 3

 QUESTION: What type of pair should each


edge be (multiple edges not allowed)?
GRAPH THEORY
 DIGRAPH:
(2,2)
 ANSWER:
2
(1,2) (2,3)

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


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

4
(4,4)

 Each edge is directed so an ordered pair (or


tuple) rather than unordered pair.
 Thus the set of edges E is just the represented
relation on V.
GRAPH THEORY
 DIGRAPH:
 A directed graph (or digraph) G = (V,E )
consists of a non-empty set V of vertices (or
nodes) and a set E of edges with E V V.
 The edge (a,b) is also denoted by a b and a
is called the source of the edge while b is
called the target of the edge.
GRAPH THEORY
 DIGRAPH:
 QUESTION:
 For a set V with n elements, how many
possible digraphs are there?

 ANSWER:
 The same as the number of relations on V,
which is the number of subsets of V V so
2n·n.
GRAPH THEORY
 DIRECTED MULTIGRAPH:
 If also want to allow multiple edges in a
digraph, get a directed multigraph (or multi-
digraph).

1 3
GRAPH THEORY
 DIRECTED MULTIGRAPH:
 QUESTION: How to use sets and functions
to deal with multiple directed edges, loops?

e3
2
e1 e4 e6
e2 e5
1 3
e7
GRAPH THEORY
 ANSWER:
 Have function with domain the edge set and
codomain V V .
e3
2
e1 e4 e6
e2 e5
1 3
e7

 e1(1,2), e2(1,2), e3(2,2), e4  (2,3),


 e5  (2,3), e6  (3,3), e7  (3,3)
GRAPH THEORY
 GRAPHS TERMINOLOGY:
 The degree of a vertex counts the number of
edges that seem to be sticking out if you
looked under a magnifying glass:

e1 e6
1 e2 2
e5
e3 e4
3
GRAPH THEORY
 GRAPHS TERMINOLOGY:
 The degree of a vertex counts the number of
edges that seem to be sticking out if you
looked under a magnifying glass:

e1 e6
1 e2 2
e5
magnify

e3 e4
3

 Thus deg(2) = 7 even though 2 only


incident with 5 edges.
GRAPH THEORY
 GRAPHS TERMINOLOGY:
 QUESTION: How to define this formally?

e1 e6
1 e2 2
e5
magnify

e3 e4
3

 A: Add 1 for every regular edge incident with vertex


and 2 for every loop. Thus deg(2) = 1 + 1 + 1 + 2 + 2 = 7.
GRAPH THEORY
 GRAPHS TERMINOLOGY:
 Oriented Degree when Edges Directed
 The in-degree of a vertex (deg-) counts the
number of edges that stick in to the vertex.
The out-degree (deg+) counts the number
sticking out.
 A source is a vertex with 0 in-degree; and a
sink, 0 out-degree.
2

1 3
GRAPH THEORY
 QUESTION:
 What are in-degrees and out-degrees of all the vertices?

 ANSWER:
1 3
 deg-(1) = 0
 deg-(2) = 3
 deg-(3) = 4
 deg+(1) = 2
 deg+(2) = 3
 deg+(3) = 2
GRAPH THEORY
 HANDSHAKING THEOREM:
e1 e6
1 e2 2

e3 e4 e5 e7
3 4

 There are two ways to count the number of edges


in the above graph:
 Just count the set of edges: 7
 Count seeming edges vertex by vertex and
divide by 2 because double-counted edges:
 ( deg(1)+deg(2)+deg(3)+deg(4) )/2 =
(3+7+2+2)/2 = 14/2 = 7
GRAPH THEORY
 HANDSHAKING THEOREM:
 In an undirected graph:

1
| E |   deg(e)
2 eE
 In a directed graph:

|E|   ( e) 
deg
eE

 (e)
deg
eE

GRAPH THEORY
 QUESTION:
 A group member presented in class that in
their group of 5 people, each member is
collaborating with exactly three others. How
is this so?
GRAPH THEORY
 QUESTION:
 In a party of 5 people can each person be
friends with exactly three others?
GRAPH THEORY
 ANSWER:
 Imagine a simple graph with 5 people as
vertices and edges being undirected edges
between friends (simple graph assuming
friendship is symmetric and irreflexive).
Number of friends each person has is the
degree of the person.
 Handshaking would imply that
 |E | = (sum of degrees)/2 or
 2|E | = (sum of degrees) = (5·3) = 15.
 Impossible as 15 is not even. In general:?
GRAPH THEORY
 HANDSHAKING THEOREM:
 Lemma: The number of vertices of odd
degree must be even in an undirected graph.

 Proof : Otherwise would have


 2|E | = Sum of even no.’s + an odd number
of odd no.’s
 even = even + odd
 this is impossible. 
GRAPH THEORY (Graph Patterns)
 GRAPH PATTERNS:
Complete Graphs - Kn
 A simple graph is complete if every pair of
distinct vertices share an edge. The notation
Kn denotes the complete graph on n vertices.

K1 K2

K3

K4 K5
GRAPH THEORY (Graph Patterns)
 Cycles - Cn
The cycle graph Cn is a circular graph with V =
{0,1,2,…,n-1} where vertex i is connected to i +1
mod n and to i -1 mod n. They look like
polygons:

C2
C1
C3

C4 C5
GRAPH THEORY (Graph Patterns)
 Wheels - Wn
 The wheel graph Wn is just a cycle graph with
an extra vertex in the middle:

W2
W1
W3

W4 W5
GRAPH THEORY (Bipartite Graphs)
 Bipartite Graphs
 A simple graph is bipartite if V can be partitioned
into V = V1 V2 so that any two adjacent vertices
are in different parts of the partition.
 Another way of expressing the same idea is
bichromatic: vertices can be colored using two
colors so that no two vertices of the same color
are adjacent
COLORABILITY
Definition: A coloring of a simple graph is the
assignment of a color to each vertex of the
graph so that no two adjacent vertices are
assigned the same color.
COLORABILITY
Definition: A coloring of a simple graph is the
assignment of a color to each vertex of the
graph so that no two adjacent vertices are
assigned the same color.
COLORABILITY
Definition: A vertex coloring of G is a map f :
V (G) → C, where C is a set of distinct colors;
it is proper if adjacent vertices of G receive
distinct colors of C; that is, if [u,v] ∈ E(G)
then f(u) ≠ f(v).
1 2 V 1  red
V 2  blue
V 3  red
4 3
V 4  blue
COLORABILITY
Definition: A vertex coloring of G is a
mapping Φ : V (G) → Z, satisfying the
conditions that Φ(x) ≠ Φ(x) if [x,y] ε E(G).

1 2 V1  1
V2  2
V3  1
4 3
V4  2
COLORABILITY
Definition: A k-coloring of a graph G is a
vertex coloring of G that uses k colors.

red and blue  2 colors

2  coloring

yellow , blue , green  3 colors

3  coloring
COLORABILITY
Definition: A k-coloring of a graph G is a
coloring Φ : V (G) → Z, such that the range of
Φ is contained in {1,2,3,…,k}.
2  coloring

range   1,2 

3  coloring
range   1,2 ,3
COLORABILITY
Definition: A graph G is k-colorable if it has
k-coloring.

2  coloring

2  colorable

3  coloring

3  colorable
COLORABILITY
Remarks: If a graph is k-colorable, then it is
also r-colorable for each r≥k.

2  colorable

3  colorable 4  colorable
COLORABILITY
Remarks: If a graph is k-colorable, then it is
also r-colorable for each r≥k.
3  coloring

3  colorable

4  coloring

4  colorable
COLORABILITY
The chromatic number of a graph is the least number
of colors needed for a coloring of the graph. The
chromatic number is denoted by X(G). If X(G) = k,
G is said to be k-chromatic.
The chromatic number is 2.
X(G) = 2
4  colorable

3  colorable

2  colorable
COLORABILITY
What is the chromatic number of the graph
shown below?
b e
The chromatic number must be
a d g at least 3 since a, b, and c must
be assigned different colors. So
lets try 3 colors first.
c f
b e
3 colors work, so the chromatic
a d g
number of this graph is 3.

c f
COLORABILITY
What is the chromatic number of the graph
shown below?

We have succeeded in coloring the graph. However, it is


possible to accomplish the coloring using fewer colors.
COLORABILITY
What is the chromatic number of the graph
shown below?

the chromatic number is 3


COLORABILITY
What is the chromatic number of the graph
shown below?

the chromatic number is 3


COLORABILITY
What is the chromatic number of the graph
shown below?

the chromatic number is 3


COLORABILITY
What is the chromatic number of the graph
shown below?
White
White Yellow

Green Yellow
Yellow White

White Yellow Yellow White

Chromatic number: 2 Chromatic number: 3


vertex coloring
Chromatic Numbers for Common Graph
Families
1. Cycles graphs
3a. Even cycles graphs

X(C2n) = 2

3b. Odd cycles graphs

X(C2n+1) = 3
vertex coloring
Chromatic Numbers for Common Graph
Families
2. Wheel graphs
4a. Even wheel graphs

X(W2n) = 3

4b. Odd wheel graphs

X(W2n+1) = 4
vertex coloring
Chromatic Numbers for Common Graph
Families
3. Complete graphs

X(K4) = 4

X (Kn) = n

X(K5) = 5
vertex coloring
Chromatic Numbers for Common Graph
Families
4. Bipartite graphs

X(G) = 2
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 67
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 68
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 69
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 70
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 71
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 72
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 73
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 74
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 75
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 76
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

L23 77
GRAPH THEORY (Bipartite Graphs)

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:


GRAPH THEORY (Bipartite Graphs)
 Question:
 For which n is Cn bipartite?

 Answer:
 Cn is bipartite when n is even. For even n color all
odd numbers red and all even numbers green so
that vertices are only adjacent to opposite color.
 If n is odd, Cn is not bipartite. If it were, color 0
red. So 1 must be green, and 2 must be red. This
way, all even numbers must be red, including vertex
n-1. But n-1 connects to 0 .
GRAPH THEORY (Bipartite Graphs)
 Example:
 Is the graph Bipartite?

 Create a graph bipartition.


GRAPH THEORY (Bipartite Graphs)
 Answer:
 Is the graph Bipartite? Yes!
GRAPH THEORY (Bipartite Graphs)
 Example:
 Is the graph Bipartite?

 Create a graph bipartition.


GRAPH THEORY (Bipartite Graphs)
 Answer:
 Is the graph Bipartite? Yes!
GRAPH THEORY (Bipartite Graphs)
 Example:
 Is the graph Bipartite?

 Create a graph bipartition.


GRAPH THEORY (Bipartite Graphs)
 Answer:
 Is the graph Bipartite? Yes!
GRAPH THEORY (Bipartite Graphs)
Complete Bipartite - Km,n :
 When all possible edges exist in a simple bipartite
graph with m red vertices and n green vertices, the
graph is called complete bipartite and the notation
Km,n is used.

 Example:

K2,3
K4,5
GRAPH THEORY (Bipartite Graphs)
 Example:
 Are the graphs complete bipartite graphs between
the colored and circles?
GRAPH THEORY (Bipartite Graphs)
 Answer:
 Yes, all of them.
GRAPH THEORY (Planar Graphs)
 Planar Graphs:
 A planar graph is one that can be drawn on a plane
in such a way that there are no "edge crossings,"
 i.e. edges intersect only at their common vertices.

C4 C5
GRAPH THEORY (Planar Graphs)
 Planar Graphs:
 Understanding planar graph is important:
 Any graph representation of maps/
topographical information is planar.
 Circuits usually represented by planar graphs.
GRAPH THEORY (Planar Graphs)
 Planar Graphs:
 Common Misunderstanding:
 Just because a graph is drawn with edges crossing
doesn’t mean its not planar.
 QUESTION: Why can’t we conclude that the
following is non-planar?.
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

92
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

93
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

94
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

95
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

96
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

97
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

98
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

99
GRAPH THEORY (Planar Graphs)
A: Because it is isomorphic to a graph which
is planar:

100
GRAPH THEORY (Planar Graphs)
 Planar Graphs:
 To prove that a graph is planar amounts to
redrawing the edges in a way that no edges will
cross. May need to move vertices around and the
edges may have to be drawn in a very indirect
fashion.
GRAPH THEORY (Planar Graphs)
 Example:
 Show that the 3-cube is planar.
GRAPH THEORY (Planar Graphs)
 The four color problem:
 Also known as Guthrie's Problem:
 Given any map, can the regions can be colored using
at most four colors so that no two adjacent regions
have the same color?
GRAPH THEORY (Planar Graphs)
 Four color problems as planar graphs :
GRAPH THEORY (Planar Graphs)
 Four color problems as planar graphs:
 Is it possible for this outline? Ans.: Yes!
GRAPH THEORY (Planar Graphs)
 The four color problem:
GRAPH THEORY (Planar Graphs)
 The Three Utilities problem:
 Suppose there are three
cottages on a plane and
each needs to be
connected to the gas,
water, and electric
companies. Sending any of
the connections through
another company or
cottage are disallowed.
Layout a way to make all
nine connections without
any of the lines crossing
each other?
GRAPH THEORY (Planar Graphs)
 Three utilities problem :
 The problem is part of the mathematical field of
topological graph theory which studies the
embedding of graphs on surfaces.
 In more formal graph-theoretic terms, the problem
asks whether the complete bipartite graph K3,3 is
planar.
GRAPH THEORY (Planar Graphs)
 Example:
 The smallest graphs that are not planar.

K3,3
K5
GRAPH THEORY (Planar Graphs)
 Remarks:
 A graph is planar if and only if it does not contain
the K5 and the K3,3 as a homeomorphic subgraph.

K3,3
K5
GRAPH THEORY (Planar Graphs)
 Two graphs G and H are homeomorphic if they can be
made isomorphic by inserting new vertices (of degree
2) into their existing edges.
GRAPH THEORY (Adjacency Matrix)
 Adjacency Matrix:
 A way of representing relations on a set is with a
Boolean matrix:
R digraph(R) MR

1 1 2 1 1 1 1
 
2 2 0 1 1 1
3 3 1 3 0 0 1 1
 
4 4 0 0 0 1

4
GRAPH THEORY (Adjacency Matrix)
 Adjacency Matrix:
 For a digraph G = (V,E ) define matrix AG by:
 Rows, Columns –one for each vertex in V
 Value at i th row and j th
column is
 1 if i th vertex connects to j th
vertex (i  j )
 0 otherwise
GRAPH THEORY (Adjacency Matrix)
 Adjacency Matrix:
 For a digraph G = (V,E ) define matrix AG by:
 Rows, Columns –one for each vertex in V
 Value at i th row and j th
column is
 1 if i th vertex connects to j th
vertex (i  j )
 0 otherwise
GRAPH THEORY (Adjacency Matrix)
 Adjacency Matrix for Multigraphs:
 Can easily generalize to directed multigraphs by
putting in the number of edges between vertices,
instead of only allowing 0 and 1:
 For a directed multigraph G = (V,E ) define the
matrix AG by:
 Rows, Columns –one for each vertex in V
 Value at i th row and j th column is the number of
edges with source the i th vertex and target the
j th vertex
GRAPH THEORY (Adjacency Matrix)
 Example:
 What is the adjacency matrix?

1 4 3

 Answer:
0 3 0 1
 
0 1 2 0
0 1 2 0
 
0 0 0 0 

GRAPH THEORY (Adjacency Matrix)
 Adjacency Matrix for Undirected Graphs:
 Undirected graphs can be viewed as directed graphs
by turning each undirected edge into two oppositely
oriented directed edges, except when the edge is a
self-loop in which case only 1 directed edge is
introduced.

1 2 1 2

3 4 3 4
GRAPH THEORY (Adjacency Matrix)
 Example:
 What is the adjacency matrix?

1 2

3 4
 Answer:
0 2 1 0
 
2 2 1 0
1 1 0 0
 
0 0 0 1 

GRAPH ISOMORPHISM
 Graph Isomorphism:
 Various mathematical notions come with their own
concept of equivalence, as opposed to equality:
 Equivalence for sets is bijectivity:
 { , , }  {8, 12, 16}

 Equivalence for graphs is isomorphism:


GRAPH ISOMORPHISM
 Graph Isomorphism:
 Intuitively, two graphs are isomorphic if you can
bend, stretch and reposition vertices of the first
graph, until the second graph is formed.
 Etymologically, isomorphic means “same shape”. :
 Can twist or relabel:

 to obtain:
GRAPH ISOMORPHISM
 Graph Isomorphism Definition:
 Suppose G1 = (V1, E1 ) and G2 = (V2, E2 ) are
pseudographs. Let f :V1V2 be a function such that
 f is bijective
 for all vertices u,v in V1, the number of edges
between u and v in G1 is the same as the
number of edges between f (u) and f (v ) in G2.
 Then f is called an isomorphism and G1 is said to be
isomorphic to G2.
GRAPH ISOMORPHISM
Example: Prove that

 is isomorphic to .

First label the vertices:

2 2
1 3 1 3

5 4
5 4
GRAPH ISOMORPHISM
Next, set f (1) = 1 and try to walk around
clockwise on the star.

2 2
1 3 1 3

5 4
5 4
GRAPH ISOMORPHISM
Next, set f (1) = 1 and try to walk around
clockwise on the star. The next vertex seen
is 3, not 2 so set f (2) = 3.

2 2
1 3 1 3
5 4
5 4
GRAPH ISOMORPHISM
Next, set f (1) = 1 and try to walk around
clockwise on the star. The next vertex seen
is 3, not 2 so set f (2) = 3. Next vertex is 5 so
set f (3) = 5.

2 2
1 3 1 3
5 4
4
5
GRAPH ISOMORPHISM
Next, set f (1) = 1 and try to walk around
clockwise on the star. The next vertex seen
is 3, not 2 so set f (2) = 3. Next vertex is 5 so
set f (3) = 5. In this fashion we get f (4) = 2

2 2
1 3 1 3
5
4 5 4
GRAPH ISOMORPHISM
Next, set f (1) = 1 and try to walk around
clockwise on the star. The next vertex seen
is 3, not 2 so set f (2) = 3. Next vertex is 5 so
set f (3) = 5. In this fashion we get f (4) = 2, f
(5) = 4.

2 2
1 3 1 3

5 4 5 4
GRAPH ISOMORPHISM
Next, set f (1) = 1 and try to walk around
clockwise on the star. The next vertex seen
is 3, not 2 so set f (2) = 3. Next vertex is 5 so
set f (3) = 5. In this fashion we get f (4) = 2, f
(5) = 4. If we would continue, we would get
back to f (1) =1 so this process is well defined
and f is a morphism.

2 2
1 3 1 3

5 4
5 4
GRAPH ISOMORPHISM
Next, set f (1) = 1 and try to walk around clockwise
on the star. The next vertex seen is 3, not 2 so set f
(2) = 3. Next vertex is 5 so set f (3) = 5. In this
fashion we get f (4) = 2, f (5) = 4. If we would
continue, we would get back to f (1) =1 so this
process is well defined and f is a morphism. Finally
since f is bijective, f is an isomorphism.

2 2
1 3 1 3

5 4
5 4
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
GRAPH ISOMORPHISM
 Properties of Isomorphism:
 Since graphs are completely defined by their vertex
sets and the number of edges between each pair,
isomorphic graphs must have the same intrinsic
properties. I.e. isomorphic graphs have the same…
 …number of vertices and edges
 …degrees at corresponding vertices
 …types of possible subgraphs
 …any other property defined in terms of the
basic graph theoretic building blocks!
GRAPH ISOMORPHISM
 Negative Examples:
 Once you see that graphs are isomorphic, easy to
prove it. Proving the opposite, is usually more
difficult.
 To show that two graphs are non-isomorphic need to
show that no function can exist that satisfies
defining properties of isomorphism.
 In practice, you try to find some intrinsic property
that differs between the 2 graphs in question.
GRAPH ISOMORPHISM
 Negative Examples:
 Why are the following non-isomorphic?

u2 v2

u1 u3 v3
v1

u5 u4 v4

 A: 1st graph has more vertices than 2nd.


GRAPH ISOMORPHISM
 Negative Examples:
 Why are the following non-isomorphic?
v2
u2

u3 v1 v3
u1

u5 u4 v5 v4

 A: 1st graph has more edges than 2nd.


GRAPH ISOMORPHISM
 Negative Examples:
 Why are the following non-isomorphic?
v2
u2

u3 v1 v3
u1

u5 u4 v5 v4

 A: 2nd graph has vertex of degree 1, 1st graph doesn't.


GRAPH ISOMORPHISM
 Negative Examples:
 Why are the following non-isomorphic?

u1 u2 u3 u4 u5 u6

u7 u8 u9

v1 v2 v3 v4 v5 v6

v7 v8 v9

 A: 1st graph has 2 degree 1 vertices, 4 degree 2 vertex and 2


degree 3 vertices. 2nd graph has 3 degree 1 vertices, 3 degree
2 vertex and 3 degree 3 vertices.
GRAPH ISOMORPHISM
Q: Why are the following non-isomorphic?

u1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6

u7 u8 v7 v8
GRAPH ISOMORPHISM
Q: Why are the following non-isomorphic?
??? None of the previous approaches work as there are
the same no. of vertices, edges, and same no. of
vertices per degree.

u1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6

u7 u8 v7 v8
GRAPH ISOMORPHISM
LEMMA: If G and H are isomorphic, then any subgraph of
G will be isomorphic to some subgraph of H.

> So, find a subgraph of 2nd graph which isn’t a


subgraph of 1st graph.

u1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6

u7 u8 v7 v8
GRAPH ISOMORPHISM
Q: Why are the following non-isomorphic?

A: This subgraph is not a subgraph of the left graph.

u1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6

u7 u8 v7 v8
GRAPH ISOMORPHISM
Q: Why are the following non-isomorphic?

A: This subgraph is not a subgraph of the left graph.

Q: Why not?

u1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6

u7 u8 v7 v8
GRAPH ISOMORPHISM
Q.: Why is this subgraph is not a subgraph of the left graph?
A.: Deg. 3 vertices must map to deg. 3 vertices. Since
subgraph and left graph are symmetric, can assume v2
maps to u2. Adjacent deg. 1 vertices to v2 must map to
degree 1 vertices, forcing the deg. 2 adjacent vertex v3 to
map to u3. This forces the other vertex adjacent to v3,
namely v4 to map to u4. But then a deg. 3 vertex has
mapped to a deg. 2 vertex 
u1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6

u7 u8 v7 v8
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
GRAPH ISOMORPHISM
 Theorem:
 Two graphs G and H are isomorphic if and only if
they have a common adjacency matrix.
 Moreover, two isomorphic graphs have exactly the
same set of adjacency matrices.
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?

0 0 0 0 1 0 1 1
1 1 0 1 0 1 0 0
1 1 0 1 1 0 1 1
0 0 1 0 0 0 0 0
GRAPH ISOMORPHISM
 Example:
 Determine which letters are isomorphic.
GRAPH ISOMORPHISM
 Example:
 Are these graphs isomorphic?
 Are these two graphs isomorphic?

L23 153
 Are these two graphs isomorphic?

L23 154
 Are these two graphs isomorphic?

L23 155
 So these graphs are isomorphic…

L23 156
GRAPH ISOMORPHISM
 Definition: Let G be a graph with vertices v and w.
 A walk from v to w is a finite alternating sequence
of vertices and edges
v0e1v1e2v2…vn – 1en – 1vn
 where v0 = v, vn = w, and each ei has endpoints vi – 1

and vi.
GRAPH ISOMORPHISM
 Example:
 A walk from A to F.

A D

B E

C F
GRAPH ISOMORPHISM
 Definition: Let G be a graph with vertices v and w.
 A path from v to w is a walk from v to w in which the
edges are distinct.
 A simple path from v to w is a path from v to w in
which the vertices are distinct.
 A closed walk is a walk that starts and ends at the
same vertex.
GRAPH ISOMORPHISM
 Example:
 A path from A to F.

A D

B E

C F
GRAPH ISOMORPHISM
 Example:
 A simple path from A to F.

A D

B E

C F
GRAPH ISOMORPHISM
 Example:
 A closed walk from A to A.

A D

B E

C F
GRAPH ISOMORPHISM
 Definition: Let G be a graph with vertices v and w.
 A circuit is a closed path.
 A simple circuit is a circuit in which the vertices are
distinct, except for the first and last vertices.
GRAPH ISOMORPHISM
 Example:
 A circuit from A to A.

A D

B E

C F
GRAPH ISOMORPHISM
 Example:
 A simple circuit from A to A.

A D

B E

C F
GRAPH ISOMORPHISM
 Definition:
 An Euler circuit of a graph G is a circuit that
contains every vertex of G at least once and every
edge of G exactly once.
GRAPH ISOMORPHISM
 Origin of Problem
 In the town of Konigsberg there was an island in the river
connected by seven bridges to the rest of the city. The
question was whether you could find a path starting and ending
at the same spot, that crossed each bridge exactly once.
 Solution of Problem
 This problem was solved by Euler, who represented each
bridge as an edge, and each terminal point of a bridge as a
node in a graph. Then he found a necessary and sufficient
condition on each of the nodes: each node must have even
degree (even number of edges incident to it). All nodes have
odd degree. So it is impossible to find a closed path that uses
each edge exactly once.
GRAPH ISOMORPHISM
 Euler's Theorem
 Let G be a connected graph (every pair of nodes is joined by
some path). Then a necessary and sufficient condition for G to
have an Euler circuit is that each node of G has even degree.
 So if a graph has an euler circuit, then every vertex of the
graph has even degree.
 If some vertex of a graph has odd degree, then the graph
does not have an Euler circuit.
GRAPH ISOMORPHISM
 Euler's Theorem

Note: A multigraph is said to be traversable if


it “can be drawn without any breaks in the
curve and without repeating any edges,” that is,
if there is a path which includes all vertices and
uses each edge exactly once. Such a path must
be a trail (since no edge is used twice) and will
be called a traversable trail.
GRAPH ISOMORPHISM
Example: Which figure is an Euler Circuit?
GRAPH ISOMORPHISM
A graph that has an Euler circuit is called an
Eulerian graph.

Theorem: A graph is Eulerian if and only if it is connected,


and every vertex has an even degree.
GRAPH ISOMORPHISM
Example: Determine which of the graphs are
Eulerian.
GRAPH ISOMORPHISM
 Definition: Hamilton Circuits
 A seemingly related problem is the Hamiltonian
circuit problem. Here, goal is to traverse the entire
graph, starting at node a and visiting each node
exactly once, before returning to a.
 Notice this means you cannot traverse a given edge
more than once (Exception: G has only two nodes),
for then you would be visiting at least one of the
endpoints of that edge more than once. So in this
sense, the Hamilton Circuit problem is more
demanding than the Euler circuit problem..
GRAPH ISOMORPHISM
 Hamilton Circuits
Note that an Eulerian circuit traverses every edge exactly
once but may repeat vertices, while a Hamiltonian circuit
visits each vertex exactly once but may skip edges.
GRAPH ISOMORPHISM
 Example:
 A Hamiltonian Circuit.
GRAPH ISOMORPHISM
 Comparison:
Euler Circuit Hamilton Circuit

Repeated visits to a given node are allowed. Visit each node exactly once.

Traverse each edge exactly once (by defn Repeated traversals of a given edge are not
of problem). permitted, since that would result in
visiting a node more than once.
No node may be omitted (if so, one of the No node may be omitted (by defn of the
edges incident to the node would not be problem).
traversed).
No edges may be omitted (by defn of the Any edge may be omitted, as long as its
problem). endpoints can be reached via some other
path.
GRAPH ISOMORPHISM
 Comparison:
GRAPH ISOMORPHISM
 Theorem (Dirac’s Theorem):
A simple, connected graph is Hamiltonian if the number
of vertices is at least three and at most twice the degree of
each vertex. (Recall that a graph is simple if it has no
multiple edges or loops.)
GRAPH ISOMORPHISM
 Example: Identify which are Hamiltonian Circuits.
Apply Dirac’s Theorem if possible.
Unlike the Euler circuit problem, finding Hamilton circuits is hard. There is no
simple set of necessary and sufficient conditions, and no simple algorithm. But
here is a list of conditions that must be satisfied:
Necessary conditions for Hamilton circuit
Assume G has more than 2 nodes.
1. No vertex of degree 1
If a has degree 1, then the other endpoint of the edge incident to a must be
visited at least twice in any circuit of G.
2. If a node has degree 2, then both edges incident to it must be in any Hamilton
circuit.
3. No smaller circuits contained in any Hamilton circuit (the start/endpoint of any
smaller circuit would have to be visited twice).
4. There must exist a subgraph H of G with the following properties:
5. H contains every vertex of G
6. H is connected
7. H has the same number of edges as vertices
8. H has every node with degree 2
9. The subgraph H is the Hamilton circuit in the graph G.
Page 634 Prop 11.2.6

kavita hatwal math 231 fall 2002


Travelling Salesperson Problem
Page635, 11.2.9
This is a famous problem. It goes like this:
1. A salesperson has a route among n cities.
2. He/she would like to visit all the cities, but in a way to minimize the total
distance travelled.
This is a weighted Hamilton circuit problem. You have to find a route that visits
each city exactly once, but in addition, the edges connecting the cities are
weighted according to the distances between those cities. So you want the sum
of the edge weights to be minimized. Graph representation of problem
The problem translates into finding the minimum weighted Hamiltonian circuit in
a connected graph on n vertices. It is difficult because:
3. There is no simple algorithm for finding a hamiltonian circuit.
4. Among hamiltonian circuits, the best you can do is compute the "weight"
(summed distance) of each, and find the min.
For a complete graph on n nodes, there are n! different hamiltonian circuits.
Comparing them all is beyond the range of any known (or possible) computer,
when n gets large.

kavita hatwal math 231 fall 2002


Definition: In graph theory a tree is defined
as a connected graph containing no closed paths.
 
Theorem: Let G be a graph with n > 1
vertices. Then the following statements are
equivalent:

(i) G is a tree.

(ii) G contains no closed paths and has edges.

(iii) G is connected and has edges.


Just a Review…

Complete Graphs
A graph G is said to be complete if every vertex in G is
connected to every other vertex in G. Thus a complete
graph G must be connected. The complete graph with n
vertices is denoted by Kn.
Just a Review…
Regular Graphs
• A graph G is regular of degree k or k-regular if every
vertex has degree k. In other words, a graph is regular
if every vertex has the same degree.

• The connected regular graphs of degrees 0, 1, or 2 are


easily described. The connected 0-regular graph is the
trivial graph with one vertex and no edges. The
connected 1-regular graph is the graph with two
vertices and one edge connecting them. The connected
2-regular graph with n vertices is the graph which
consists of a single n-cycle.
Just a Review…
Regular Graphs
• The 3-regular graphs must have an even number of
vertices since the sum of the degrees of the vertices is
an even number. The figures in the next slide show two
connected 3-regular graphs with six vertices.
• In general, regular graphs can be quite complicated. For
example, there are nineteen 3-regular graphs with ten
vertices. We note that the complete graph with n
vertices Kn is regular of degree n − 1.
Just a Review…
Regular Graphs
PREPARATION FOR THE COURSE

You might also like