0% found this document useful (0 votes)
50 views47 pages

Colouring Probability

This lecture discusses graph colouring, including: 1) The vertex coloring problem of assigning colors to vertices such that no adjacent vertices have the same color. 2) The chromatic number, which is the minimum number of colors needed to color a graph. 3) An inequality showing that the chromatic number is at most the maximum degree of vertices plus one.

Uploaded by

jason
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views47 pages

Colouring Probability

This lecture discusses graph colouring, including: 1) The vertex coloring problem of assigning colors to vertices such that no adjacent vertices have the same color. 2) The chromatic number, which is the minimum number of colors needed to color a graph. 3) An inequality showing that the chromatic number is at most the maximum degree of vertices plus one.

Uploaded by

jason
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Lecture 11: Graph Colouring

COMP2121: Discrete Mathematics

Yuxiang Yang

Department of Computer Science, Faculty of Engineering

Yuxiang Yang Lecture 11: Graph Colouring


Why and where

Learning Outcomes:
O1 Understand abstract mathematical concepts

O2 Perform abstract thinking

O3 Analyse and enumerate

Where:
Sections 10.8 of the textbook

Yuxiang Yang Lecture 11: Graph Colouring


Content

O1 The vertex coloring problem

O1 The chromatic number, examples

O2,O3 Inequality for the chromatic number

O2 Other coloring problems

Yuxiang Yang Lecture 11: Graph Colouring


Colouring [O1]

Yuxiang Yang Lecture 11: Graph Colouring


Colouring maps

When drawing a map, it is good to use


different colors for adjacent regions.

Can we color the map with 2 colors?

With 3 colors?
With 5, 6 ...?

What is the minimum number of colors needed?

Yuxiang Yang Lecture 11: Graph Colouring


Formulation in terms of graphs
Represent each region with a vertex

draw an edge between two vertices if the corresponding


regions are adjacent.

Many maps can be reduced to the same graph:

Yuxiang Yang Lecture 11: Graph Colouring


The vertex coloring problem

Problem: Given a (simple) graph G, color the vertices in such


a way that no adjacent vertices have the same color.

Definition: A graph is called n-colorable, if it can be colored


with n colors in such a way that adjacent vertices have
different colors.

Example:

Yuxiang Yang Lecture 11: Graph Colouring


The chromatic number

The chromatic number γ of a graph is the minimum number


of colors needed to color the graph.

Example: Cn
every cycle graph with
even number of vertices
has γ = 2.

every cycle graph with


odd number of vertices
has γ = 3.

Yuxiang Yang Lecture 11: Graph Colouring


More examples

the complete graph Kn


has γ = n.

the complete bipartite


graph Km,n has γ = 2.

Yuxiang Yang Lecture 11: Graph Colouring


An inequality on the chromatic number [O3]

Yuxiang Yang Lecture 11: Graph Colouring


An easy result

Theorem:

Let k := maxv∈V deg(v) be the maximum degree of the


vertices in a graph G = (V, E).
Then, one has γ ≤ k + 1.

Proof: By induction on the maximum degree.

Predicate P (n): every graph with maximum degree k ≤ n can


be colored with n + 1 colors.
Base case: P (1) is true.

Yuxiang Yang Lecture 11: Graph Colouring


Induction step: P (n) =⇒ P (n + 1).

Let G be a graph with maximum degree k = n + 1


1 Pick a vertex v with degree n + 1 and remove it. After v is
removed, all the vertices adjacent to v have degree ≤ n.
2 If the maximum degree in the graph is still n + 1, pick another
vertex w with degree n + 1 and remove it.
Note that v and w cannot be adjacent.
3 Continue until the remaining graph has maximum degree ≤ n
Note that all the vertices we removed must be non-adjacent.
4 Once we obtained a graph with maximum degree ≤ n, the
induction hypothesis implies that the graph can be colored
with n + 1 colors.
5 Put back all the edges that have been removed and color them
with a new color. Since none of the vertices we removed were
adjacent to one another, no adjacent vertex has the same color.

Hence, we have shown that the graph G is (n + 2)-colorable.


This proves P (n + 1).
Yuxiang Yang Lecture 11: Graph Colouring
Proof concluded

In summary, we showed that every graph with maximum


degree n + 1 can be colored with n + 2 colors.

In other words, P (n) implies P (n + 1). This concludes the


proof by induction. QED.

4 2

2 2

2 2
Example:
maxv∈V deg(v) = 4 =⇒ γ ≤ 5 (actually 3 are enough)

Yuxiang Yang Lecture 11: Graph Colouring


More properties of the chromatic number

The chromatic number satisfies 1 ≤ γ ≤ n for a graph of n


vertices.

If a graph G contains a clique (a complete subgraph) of k


vertices, then γ(G) ≥ k.

A graph is bipartite if and only if it does not contain an odd


cycle (i.e., any cycle whose length is an odd number).
(Proof see next slide)
Remark: We know from Lecture 8 that a graph is bipartite if
and only if it is 2-colorable. Therefore the 3 conditions:
2-colorable, bipartite, and no-odd-cycle, are equivalent.

Yuxiang Yang Lecture 11: Graph Colouring


Proof:
a graph is bipartite =⇒ no odd cycle: If there is any odd
cycle, it must visit vertices in V2 and V1 alternatively, starting
from a vertex in V1 . Since the cycle is odd, it must end in V2 ,
meaning that the starting and the ending vertices are different
(contradiction!).

no odd cycle =⇒ bipartite:


Take an arbitrary vertex v. Define V1 to be the collection of
vertices whose distance from v is odd, and V0 to be the
collection of vertices whose distance from v is even.
Then V0 ∩ V1 = ∅ and V0 ∪ V1 = V . (v ∈ V0 )

For any two vertices w, x in V0 (or V1 ), we can show that


(w, x) must not be an edge in the graph:
Since d(w, v) + d(x, v) is an even number, if (x, w) is an
edge, then v − x − w − v will be an odd cycle!

Therefore, the graph must have a bipartition (V0 , V1 ).


Yuxiang Yang Lecture 11: Graph Colouring
Recurrence algorithm for graph coloring

Theorem: For any non-adjacent vertices v, u, the chromatic


number of a graph G satisfies
γ(G) = min{γ(G + (u, v)), γ(G/(u, v))}, where G + (u, v) is
the graph with edge {u, v} added, and G/(u, v) is the graph
obtained by contracting u and v.

Many graph coloring algorithms are based on this recurrence.

Yuxiang Yang Lecture 11: Graph Colouring


Proof

Observation: This follows from the observation that every


coloring of G either:
1 gives different colors to u and v, or
2 the same color to u and v.

For the first case, this gives a coloring of G + (u, v).


For the second case, this gives a coloring of G/(u, v).

On the other hand, any coloring of G + (u, v) or G/(u, v) is


also a coloring of G.

Therefore, γ(G) is the minimum of γ(G + (u, v)) and


γ(G/(u, v)).

Yuxiang Yang Lecture 11: Graph Colouring


Applications [O2]
Graph theory isn’t just for map-makers

Yuxiang Yang Lecture 11: Graph Colouring


Scheduling final exams

Suppose we have to schedule 7 finals.

The following exams have common students:


1 and 2, 1 and 3, 1 and 4, 1 and 7,
2 and 3, 2 and 4, 2 and 5, 2 and 7,
3 and 4, 3 and 6, 3 and 7,
4 and 5, 4 and 6,
5 and 6, 5 and 7,
6 and 7.

What is the minimum number of time slots needed to


schedule all exams in a way that avoids time clashes?

Yuxiang Yang Lecture 11: Graph Colouring


Graph formulation

Graph construction:
1 Exams → vertices
2 If 2 exams have common students, put an edge between the
corresponding vertices.
3 Time slots → colors.

Minimum number of time slots = chromatic number


1

7 2

6 3

5 4

Since vertices 1,2,3,4 form a complete graph K4 , we need at


least 4 colors. We can directly see, on the other hand, that 4
colors are enough.
Yuxiang Yang Lecture 11: Graph Colouring
Radio Frequencies

Two stations cannot use the same channel frequency when


they are within a distance of 150 miles.

Six stations have the following distances:


A B C D E F
A - 25 202 77 375 106
B 25 - 175 51 148 222
C 202 175 - 111 365 411
D 77 51 111 - 78 297
E 375 148 365 78 - 227
F 106 222 411 297 227 -

How many different frequencies are needed?

Yuxiang Yang Lecture 11: Graph Colouring


Graph formulation

Mapping to a graph:

Stations → vertices

If 2 stations are within 150


miles, put an edge between
the vertices.

Frequencies → colors

Minimum number of frequencies = chromatic number

Since vertices A,B,D form a triangle we need at least 3 colors.


In addition, we can directly see that 3 colors are enough.

Yuxiang Yang Lecture 11: Graph Colouring


Fish Tanks

Six different types of fish: A, B, C, D, E, and F.

Because of predator-prey relationships, water conditions, and


size etc.,
some fish cannot be kept in the same tank

Type A B C D E F
Cannot be with B,C A,C,D A,B,D,E B,C,F C,F D,E

How many fish tanks are needed?

Yuxiang Yang Lecture 11: Graph Colouring


Maps to graph theory:
V = types of fish
E = (adjacency =) fish that cannot be in the same tank

Solution: 3.
Tank 1 Tank 2 Tank 3
A,D F,C B,E

Yuxiang Yang Lecture 11: Graph Colouring


Sodoku as a non-planar graph coloring problem.
Non-planar graphs may have chromatic numbers higher than 4,
and the coloring problems for them is harder. They are also very
common in daily life.

For example: Sodoku is a non-planar graph coloring problem in


disguise. Each vertex has 20 edges coming out of it — one to each
cell in its row, in its column and in its 3-by-3 sub-square. This
graph of 81 vertices and 810 edges starts with a partial coloring
(the given clues). The object of the game is to color the rest of
the vertices.
Yuxiang Yang Lecture 11: Graph Colouring
Other coloring problems [O1]

Yuxiang Yang Lecture 11: Graph Colouring


Colouring edges and regions

Edge coloring:
color the edges of a graph in
such a way that no two incident
edges are of the same color

Region (Map) coloring:


color the regions in a planar
graph in such a way that no two
adjacent regions are of the same
color.

Yuxiang Yang Lecture 11: Graph Colouring


Reduction to vertex coloring

Reduction
Edge coloring → vertextocoloring
vertex coloring
Edge
edges →coloring
vertices! vertex coloring
• edges ! vertices
in •the newnew
in the graph, put an edge
graph,
between Reduction
two vertices if to
the vertex coloring
put an edge between two vertices
Edge coloring
corresponding edges ! in thevertex
oldcoloring
graph
if the corresponding edges in the old graph are incident.
• edges ! vertices
are incident.
• in the new graph,
put an edge between two vertices
Region coloring
Region → vertex coloring
if coloring ! vertex
the corresponding coloring
edges in the old graph are incident.
• regions
regions ! vertices
→ vertices
• in the new graph,
in the
putnewRegion
an graph,
edge coloring
put !
between vertex
an two
edge coloring
vertices
between •two
regions ! vertices
vertices if the
if the corresponding regions in the old graph are adjacent.
• in the regions
corresponding new graph,in the old
graph are put an edge between two vertices
adjacent. 21
if the corresponding regions in the old graph are adjacent.

21

Yuxiang Yang Lecture 11: Graph Colouring


Graph (Vertex) coloring should be the most general problem.

Region (Map) coloring and edge coloring can be reduced to


vertex coloring, but not the other way round. Why?

For example, the star graph S3


4

3 2

S3 does not have a corresponding graph for edge coloring,


because it is not possible to have 3 non-adjacent edges
adjacent to a forth edge.

Yuxiang Yang Lecture 11: Graph Colouring


Edge chromatic number

Similar as the (vertex) chromatic number, the edge chromatic


number of a graph is the minimum number of colors needed
to edge-color the graph.

What is the edge chromatic number of Kn ?

Observe that the edge chromatic number must be ≥ n − 1,


because n − 1 edges are sharing each vertex.

But is n − 1 enough?

Yuxiang Yang Lecture 11: Graph Colouring


When n is even, recall the round-robin tournament (from
Lecture 9):

At each round, all matches (edges) → the same color

In this way, 2 edges with the same color won’t share the same
vertex (because one team cannot play twice in one round).
Yuxiang Yang Lecture 11: Graph Colouring
There are n − 1 rounds. Therefore, the edge color number is
n − 1.

When n is odd, there is one player (vertex) left over each


round, and there are n rounds all together. Therefore the
edge chromatic number ≤ n.

There are n(n−1)


2 edges in total, and at most (n − 1)/2 edges
of each color (pigeonhole!), which implies the edge chromatic
number ≥ n.

In summary, the edge chromatic number of Kn is n − 1 when


n is even, and n when n is odd.

Yuxiang Yang Lecture 11: Graph Colouring


The complexity of coloring [O1]

Yuxiang Yang Lecture 11: Graph Colouring


Recall: NP-completeness∗

NP stands for “nondeterministic polynomial”.


The complexity class NP contains all problems whose solution
can be checked in polynomial time
(problems that are ”easy to check, but possibly hard to solve”)

A problem is NP-complete if it is
1 in NP, and
2 any other NP complete problem can be reduced to it

Determining whether a given graph has a Hamiltonian cycle


(or just a Hamiltonian path) is an NP-complete problem.

Intuitively, it is among the hardest ones in NP problems.

Yuxiang Yang Lecture 11: Graph Colouring


Complexity of vertex coloring

Every coloring problem can be reduced to vertex coloring.

The key problem is to compute the chromatic number.


This problem is NP-hard (at least as hard as the hardest NP
problem).

If you could compute the chromatic number of a generic


graph with n vertices in polynomial time (as a function of n),
then you could solve every NP problem in polynomial time!

The reason for this is that deciding whether a generic graph


with n vertices can be colored with k colors is an
NP-complete problem for every value of k ≥ 3.

What is the complexity when k = 2?

Yuxiang Yang Lecture 11: Graph Colouring


A tale of four colors

Yuxiang Yang Lecture 11: Graph Colouring


The 4-color sage
(1852) Francis Guthrie was trying to color the counties in a
map of England using the minimum number of colors. He
found out that 4 colors are always enough, and wondered if
this fact is a mathematical theorem the “4-color theorem”.
Guthrie asked to his brother, a student at UCL, who asked his
math professor, Augustus de Morgan (of the “de Morgan
law”)

Yuxiang Yang Lecture 11: Graph Colouring


(1852) Somebody post the question on a math magazine,
signing as F.G. Nobody answers the question.

(1860) De Morgan post the question again on the same


magazine. Still, nobody answers.

(1879) Alfred Kempe published a proof and became famous


for it.

(1880) Peter Tait published an alternative proof.

Yuxiang Yang Lecture 11: Graph Colouring


(1890) Percy Heawood discovered that Kempe’s proof is
wrong (11 years later!) But: it can be used to prove a 5-color
theorem.

(1891) Julius Petersen discovered that Taits’s proof is also


wrong.

Yuxiang Yang Lecture 11: Graph Colouring


(1960-1970s; 70+ years later) German mathematician
Heinrich Heesch developed methods for proving the 4-color
theorem with the help of a computer. But he had to stop
before getting the proof, because he could not get enough
supercomputer time.

(1976) Proof by Appel and Haken (University of Illinois). In


the history of mathematics, this is the first proof achieved
through the help of a computer.

Yuxiang Yang Lecture 11: Graph Colouring


The proof was based on the observation that every map must
contain at least one network from a list of 1936 networks.

A supercomputer was used to show that every network in this


list is 4-colorable, to which the original 4-color problem was
reduced.
Yuxiang Yang Lecture 11: Graph Colouring
The 4-color theorem

4-Color Theorem:
Any planar graph can be region-colored using at most 4 colors.

Remark: The start of computer-assisted proofs.

Thomas Hales, pictured in 1998 (ft. Michigan Photography), used


a computer to prove a famous conjecture about the densest way to
stack spheres.
Yuxiang Yang Lecture 11: Graph Colouring
A “provable” coloring theorem

6-Color Theorem:
Any planar graph can be colored using at most 6 colors.

A proof based on Kempe’s idea (for the 4-color problem):


Lemma: For any planar graph, there exists a vertex v such
that deg(v) ≤ 5.

Proof: By contradiction.
P ≥ 6 for any w, then (handshaking)
If deg(w)
2e = w∈V deg(w) ≥ 6v, which contradicts with the planar
inequality e ≤ 3v − 6!

Yuxiang Yang Lecture 11: Graph Colouring


Proof: Assume that there exists a map that needs 7 colors.

If we take out its vertices (and associated edges) one by one,


then eventually at a stage we will need only 6 colors.

Denote by G the minimum graph that requires 7 colors, but


removing any vertex from G yields a 6-colorable graph.

By Lemma there exists a vertex v in G with deg(v) ≤ 5.

Removing v yields a 6-colorable graph G0 . Moreover, since v


is adjacent to no more than 5 vertices. There is still one color
remaining (from those used to color G0 ) that can be used to
color v.
=⇒ G is also 6-colorable, contradiction!

There does not exist any map that needs 7 colors.

Yuxiang Yang Lecture 11: Graph Colouring


Conclusions

Yuxiang Yang Lecture 11: Graph Colouring


Summary of the lecture

Vertex coloring problem (definition and examples) [O1]

the chromatic number γ [O1]

Basic inequality γ ≤ maximum degree + 1 [O2]


Other properties of the chromatic number γ.

Other coloring problems [O2]


1 regions
2 edges
3 reduction to vertex coloring

Complexity: [O1] graph coloring is NP-complete

History of the 4 color problem [O1]

Yuxiang Yang Lecture 11: Graph Colouring


Your objectives

Be aware of the notion of vertex coloring and of the basic


examples.

In the exercises: basic reasoning and counting about the


possible colorings on a graph.

Yuxiang Yang Lecture 11: Graph Colouring

You might also like