L09-Discrete Math
L09-Discrete Math
L09: Oct 10
This Lecture
Graph coloring is another important problem in graph theory.
It also has many applications, including the famous 4-color problem.
Graph Colouring
Applications
Some Positive Results
Graph Colouring
Graph Colouring Problem:
Given a graph, colour all the vertices so that
two adjacent vertices get different colours.
Objective: use minimum number of colours.
3-colourable
Optimal Colouring
Definition. min #colors for G is chromatic number, (G)
What graphs have chromatic number one?
Simple Cycles
(Ceven ) = 2
(Codd ) = 3
Complete Graphs
A graph is a complete graph if there is an edge between every pair of vertices.
Sometimes we denote a complete graph of n vertices by K n.
(Kn ) = n
Wheels
W5
(Wodd ) = 4
(Weven ) = 3
Trees
root
2-Colourable Graphs
When exactly is a graph 2-colourable?
This is 2-colourable.
Bipartite Graphs
When exactly is a graph 2-colourable?
Is a bipartite graph 2-colourable?
Bipartite Graphs
When exactly is a graph bipartite?
NO
Bipartite Graphs
When exactly is a graph bipartite?
No such edge because no 5-cycle
Chromatic Number
How do we estimate the chromatic number of a graph?
YES
NO
Chromatic Number
Let (G) be the largest complete subgraph that G contains.
Then,
Whats Next?
No one knows how to find an optimal coloring efficiently.
In fact, this is an NP-complete problem, and many researchers
believe that such an efficient algorithm does not exist (CSC 3160).
Also, no one knows a concise necessary and sufficient condition for
k-colorability. So why are we still studying this problem?
This problem is still interesting for two reasons:
1)It captures many seemingly different problems as you will see.
2)In some important special cases, we have interesting results, e.g.
- we can 4-color a map (next lecture)
- in some cases we can prove that (G) = (G) (this lecture).
This Lecture
Graph colouring
Applications
Some Positive Results
67
257
306
99
Conflict Graph
Each vertex represents a flight, and each edge represents a conflict.
If two flights need a gate at same time, then we draw an edge.
145
306
99
Graph Colouring
257
122
145
Idea: each color
67
306
represents a gate.
9
There is a k-colouring in this graph iff the flights can be scheduled using k gates.
=> If there is a schedule, the flights scheduled at the same gate have no conflict,
and so we can colour the graph by using one colour for flights in each gate.
<= If there is a graph colouring, then the vertices using each colour have no conflict,
and so we can schedule the flights having the same colour in one gate.
257
122
145
assign
gates:
67
306
257, 67
122,145
4 colors
4 gates
99
99
306
Better Colouring
257
122
67
306
3 colors
3 gates
145
99
Graph Colouring
8.02
6.042
18.02
assign
times:
3.091
4 time slots
(best possible)
M 9am
M 1pm
6.001
T 9am
T 1pm
This Lecture
Graph colouring
Applications
Some Positive Results
Maximum Degree
Suppose every vertex is of degree at most d.
How many colors we need to color this graph?
For an uncolored vertex v,
v
Maximum Degree
Fact. Given a graph with maximum degree d,
one can color it using at most d+1 colors.
Note that it is just a sufficient condition, but far from necessary.
For example, a tree could have large maximum degree, but we can
color it using only two colors.
Idea:
find a good
ordering.
Good News
For some special graphs, we know exactly when they are k-colorable.
b
a
d
c
d
c
Interval Graphs
Theorem. For interval graph G, (G) =(G).
Recall that (G) denotes the largest complete subgraph that G contains,
and (G) >=(G) because each vertex in the complete subgraph needs a
different color.
So, in the following, we just need to prove that (G) <=(G), by providing
a coloring using at most (G) colors.
We will do so by showing that there is always a vertex with degree at
most (G)-1, and thus we can produce a good ordering as in previous slides.
An Example
Now we can solve the flight gate problem and the register allocation problem.
4
1
2
7
4
6
5
8
7
12
11
10
12
11
10
Quick Summary