You are on page 1of 20

Three Color theory

Graph Coloring

Hafiz Wahid Iqbal


FA17-MSCS-1018
Contents
 Graph Coloring
 Why We Use Graph Coloring(usage)
 Graph terminologies
 Coloring a graph( Example)
 Graph Coloring Algorithms
Welsh Powell Algorithm
Basic Greedy Algorithm
 Few Interesting Applications!
Sudoku Game
GSM Networks
Graph Coloring:
it is a way of coloring the vertices of a graph such that no two adjacent vertices
are of the same color; this is called a vertex coloring
Graph Terminologies
K-Coloring: A k-coloring of a graph G is a mapping of V(G) onto the integers 1..k such that
adjacent vertices map into different integers.
A k-coloring partitions V(G) into k disjoint subsets such that vertices from different subsets
have different colors.

K Colorable : A graph G is k-colorable if it has a k Coloring

Chromatic Number of a Graph : The chromatic number of a graph is the minimum number
of colors needed to produce a proper coloring of a graph. In our scheduling example, the
chromatic number of the graph would be the minimum number of time slots needed to
schedule the meetings so there are no time conflicts.
Graph Coloring Algorithm

Graph coloring problem is a known NP Complete problem.

Although Graph coloring problem is NP Complete problem there are some


approximate algorithms to solve the graph coloring problem.

 Welsh Powell Algorithm


 Greedy Algorithm
Welsh Powell Algorithm
Find the degree of each vertex.
List the vertices in order of descending valence i.e degree(v(i))>=degree(v(i+1)).
Color the first vertex in the list.
Go down the sorted list and color every vertex not connected to the colored vertices above the same
color then cross out all colored vertices in the list.
Repeat the process on the uncolored vertices with a new color-always working in descending order of
degree until all vertices are colored.
Complexity of above algorithm = O(n2).
Welsh Powell Algorithm: Example
Welsh Powell Algorithm: Example
Welsh Powell Algorithm: Example
Welsh Powell Algorithm: Example
Welsh Powell Algorithm: Example
Basic Greedy Algorithm

Color first vertex with first color.


Do following for remaining V-1 vertices.
Consider the currently picked vertex and color it with the lowest numbered color that has
not been used on any previously colored vertices adjacent to it.
if all previously used colors appear on vertices adjacent to v, assign a new color to it.
Analysis
The above algorithm doesn’t always use minimum number of colors.
Also, the number of colors used sometime depend on the order in
which vertices are processed
Why we use Graph Coloring
Many problems can be formulated as a graph coloring problem including

 Meeting Scheduling
 Time Tabling
 Channel Assignment
etc.
Coloring a graph(Meeting Scheduling)
Sherry is a manager at MathDyn Inc. and is attempting to get a training schedule in place for
some new employees. There are four meetings to be scheduled, and she wants to use as few
time slots as possible for the meetings. However, if an employee has to be at two different
meetings, then those meetings must be scheduled at different times
Meeting Scheduling(Cont..)
She then lets colors represent different time slots, and colors the dots with these colors so
that no two dots that share an edge (that is, have an employee that needs to be at both)
have the same color (the same time slot). A couple of ways to do this are shown in the
image.

In this scenario, we want to produce a k-coloring of the graph with as few colors as possible to
keep the time slots to a minimum. Notice, in our graphs, the more colors we use, the easier it is
to avoid a scheduling conflict, but that wouldn't minimize the number of time slots.
Few Interesting Applications!
GSM Networks
GSM is a cellular network with its entire geographical range divided into hexagonal
cells. Each cell has a communication tower which connects with mobile phones
within the cell. All mobile phones connect to the GSM network by searching for
cells in the immediate vicinity. GSM networks operate in only four different
frequency ranges. The reason why only four different frequencies suffice is clear:
the map of the cellular regions can be properly colored by using only four different
colors! So, the vertex coloring algorithm may be used for assigning at most four
different frequencies for any GSM mobile phone network.
Thank You!

You might also like