You are on page 1of 43

GRAPH COLORING

UNIT V
TOPICS TO BE COVERED
COLORING
CHROMATIC NUMBER
CHROMATIC PARTITIONING
CHROMATIC POLYNOMIALS
COVERING & PARTITIONING OF A GRAPH
MATCHING
COVERING
FOUR COLOR PROBLEM
DISCUSSION OF GRAPH THEORETIC
ALGORITHM (COVERED ALREADY)

Introduction
When a map is colored, two regions
with a common border are
customarily assigned different
colors.
We want to use a small amount of
colors instead of just assigning
every region its own color.
Graph Coloring
Each map in a plane can be represented by
a graph.
Each region is represented by a vertex.
Edges connect to vertices if the regions
represented by these vertices have a common
border.
Two regions that touch at only one point are
not considered adjacent.
The resulting graph is called the dual graph
of the map.
Graph Coloring
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.
The chromatic number of a graph is the least
number of colors needed for a coloring of
the graph.
The Four Color Theorem: The chromatic
number of a planar graph is no greater than
four.
d
Example
b e

a d g


c f
The chromatic number must be
at least 3 since a, b, and c must
be assigned different colors. So
lets try 3 colors first.
b

a


c
3 colors work, so the chromatic
number of this graph is 3.
What is the chromatic number of the graph shown
below?
e
f
g
CHROMATIC NUMBER
Painting all the vertices of a graph with colors such that
no two adjacent vertices having the same color is called
proper coloring (coloring) of a graph.
A graph in which every vertex has been assigned a color
according to a proper coloring is called properly colored
graph.
The proper coloring requires the minimum number of
colors.
A graph that requires K different colors for its proper
coloring, and no less, is called a K-chromatic graph, and
the number K is called the chromatic number of G.

Example
What is the chromatic number for each graph?
White
Yellow
White
Yellow
White
Yellow
Chromatic number: 2
White
Yellow
White
Yellow
Green
Chromatic number: 3
Observations
A graph consisting only isolated vertices is 1-
chromatic.
A graph with one or more edges (not a self loop) is
at least 2-chromatic (also called bichromatic).
A complete graph of n vertices is n-chromatic, as all
its vertices are adjacent.
A graph consisting of simple one circuit with n>3 is
2-chromatic if n is even and 3-chromatic if n is odd.
Every tree with two or more vertices is 2-chromatic.
Bipartiteness
Graph G = (V,E) is bipartite iff it can be partitioned into two sets of
nodes A and B such that each edge has one end in A and the other
end in B
Alternatively:
Graph G = (V,E) is bipartite iff all its cycles have even length
Graph G = (V,E) is bipartite iff nodes can be coloured using two
colours
Question: given a graph G, how to test if the graph is bipartite?
Note: graphs without cycles (trees) are bipartite
non bipartite
bipartite:
Chromatic Partitioning
A proper coloring of a graph introduces a
partitioning of vertices into different subsets.


The partitions {v
1
, v
4
}, {v
2
} and {v
3
, v
5
}
No two vertices in any of these
subsets are adjacent.
Such a subset of vertices is called an
independent set.
A set of vertices in a graph is said to be
an independent set of vertices or
independent set if no two vertices in
the set are adjacent.
Chromatic Partitioning
A maximal independent set is an independent set to
which no other vertex can be added without
destroying its independence property.
The set {a, c, d, f} is a maximal independent set of
the following graph.
The set {b, f} is another maximal independent set
and also {b, g}

Amongst all maximal
independent sets, the
largest number of vertices
in a maximal
independence set is of
particular interest.
Chromatic Partitioning
The number of vertices in the largest independent
set of a graph G is called the independence number,
|(G).
Consider a k-chromatic graph G of n vertices.
We have the inequality, |(G) > n/k

Finding all maximal independent sets
Using Boolean arithmetic on the vertices.
Each vertex is treated as a Boolean variable.
The logical sum, a+b, denote the operation of
including vertex a or b or both.
The logical multiplication, ab, denote the operation
of including both vertices a and b.
The Boolean complement a denote the vertex a is
not included.
let us express an edge (x, y) as a Boolean product,
xy, of its end vertices x and y.

Finding all maximal independent sets
The graph is represented as = xy.
Now consider the Boolean complement, of this
expression, and express it as a sum of Boolean
products:
= f
1
+f
2
+f
3
+ . . . +f
k
A vertex set is a maximal independent set iff =0
(logically false).
Which is possible iff = 1 (logically true)
Which is possible iff each vertex appearing in f
i
(in
complemented form) is excluded from the vertex set of
G.
Thus each f
i
will yield a maximal independent set
Every maximal independent set will be produced by this
method.





Example
= ab + bc + bd + be + ce + de + ef + eg + fg
= (a+b)(b+c)(b+d)(b+e)(c+e)
(d+e)(e+f)(e+g)(f+g)
Identities (Boolean arithmetic
a + a = a
aa =a
a + b = a
Example
We get,
= bef + beg + acdef + acdeg + bcdfg
Now if we exclude from the vertex set of G vertices
appearing in any one of these five terms, we get a
maximal independent set.
The five maximal independent sets are:
acdf, acdg, bg, bf, and ae.
These are all the maximal independent sets of the
graph.
Finding Independence and
Chromatic numbers
Once all the maximal independent sets of G have
been obtained, we can find the size of the largest
number of vertices to get the independence number
| (G).
In the above graph, |(G) = 4
To find the chromatic number of G, we must find the
minimum number of these maximal independent
sets, which collectively include all the vertices of G.
For the above graph, the sets
{a, c, d, f}, {b, g} and {a, e} satisfy this condition.
Thus the graph G is 3-chromatic.
Chromatic Partitioning
Given a simple, connected graph G, partition all
vertices of G into smallest possible number of
disjoint, independent sets.
This is known as chromatic partitioning of graphs.
By enumerating all maximal independent sets and
then selecting the smallest number of sets that
include all vertices of the graph, is the chromatic
partitions of the graph.

Chromatic Partitioning
Example
{(a, c, d, f), (b, g), (e)}
{(a, c, d, g), (b, f), (e)}
{( c, d, f), (b, g), (a, e)}
{(c, d, g), (b, f), (a, e)}



CHROMATIC POLYNOMIAL
A given graph G of n vertices can be properly
colored in many different ways.
This property of a graph is expressed by means of a
polynomial.
The value of the chromatic polynomial P
n
() of a
graph G with n vertices gives the number of ways of
properly coloring the graph, using or fewer colors.
Let c
i
be the different ways of properly coloring G
using exactly i different colors.
Since i colors can be chosen out of colors in
different ways.
|
|
.
|

\
|
i

CHROMATIC POLYNOMIAL
There are different ways of properly coloring
G using exactly i colors out of colors.
Since i can be any positive integer from 1 to n, the
chromatic polynomial is a sum of these terms:


|
|
.
|

\
|
i
c
i

=
|
|
.
|

\
|
=
n
i
n
i
i
c
P
1
) (

!
) 1 )...( 2 )( 1 (
...
! 3
) 2 )( 1 (
! 2
) 1 (
! 1
3 2 1
n
n
c
c c c
n
+
+ +

+

+ =


CHROMATIC POLYNOMIAL
Each c
i
has to be evaluated individually for the given
graph.
Any graph with even one edge requires at least two
colors for proper coloring, and therefore c
1
=0.
A graph with n vertices and using n different colors
can be properly colored in n! different ways, this
means c
n
=n!.


CHROMATIC POLYNOMIAL
Consider this graph. The chromatic polynomial of this graph
is
! 5
) 4 )( 3 )( 2 )( 1 (
...
! 3
) 2 )( 1 (
! 2
) 1 (
! 1
5 3 2 1

+ +

+

+ =

c c c c
Since there is a triangle in the graph it will
require at least three different colors for
proper coloring.
Therefore c
1
=c
2
=0 and c
5
= 5!
To evaluate c
3
, suppose that we have three
different colors x, y and z.
These three colors can be assigned properly to
vertices v
1
, v
2
and v
3
in 3! = 6 different ways.
Now we do not have any choices left, because
vertex v
5
must have the same color as v
3
, and
v
4
must have the same color as v
2
.
Therefore c
3
= 3! =6

CHROMATIC POLYNOMIAL
Similarly with four colors v
1
, v
2
and v
3
can be
properly colored in 4! = 24 different ways.
The fourth color can be assigned to v
4
or v
5
, thus
providing two choices.
The fifth vertex provides no additional choices.
Therefore c
4
=24.2 = 48.


The presence of factors ( - 1) and ( - 2) indicates
that the graph is at least 3-chromatic.




) 7 5 )( 2 )( 1 (
) 4 )( 3 )( 2 )( 1 (
) 3 )( 2 )( 1 ( 2 ) 2 )( 1 ( ) (
2
5
+ =
+
+ =


P
Matching
Suppose four applicants a
1
, a
2
, a
3
and a
4
are
available to fill six vacant positions p
1
, p
2
, , p
6
.
Applicant a
1
is qualified for position p
2
or p
5
.
Applicant a
2
is qualified to fill position p
2
or p
5
.
Applicant a
3
is qualified for position p
1
, p
2
, p
3
, p
4
or
p
6
.
Applicant a
4
is qualified for position p
2
or p
5
.
This situation can be represented by a graph.



Matching
The vacant positions and applicants are represented
by vertices.
The edges represent the qualifications of each
applicant for filling different positions.





Matching
The graph is clearly bipartite as the vertices
representing applicants and the vertices
representing positions are partitioned into two
different sets.
Is it possible to hire all the applicants and assign
each a position for which (s)he is suitable!
The answer is no.
What is the maximum number of positions that can
be filled from the given set of applicants?
This is a problem of matching (or assignment) of
one set of vertices into another.




Matching
Matching in a graph is a subset of edges in which no
two edges are adjacent.
A single edge in a graph is a matching.
A maximal matching is a matching to which no edge
in the graph can be added.
The edges shown by heavy lines in the following
graph are two maximal matching.
Amongst all the maximal matching the matching
with the largest number of edges are called the
largest maximal matching.


Matching
The number of edges in a largest maximal matching
is called the matching number of the graph.
The matching points between two images (graphs)
can be used in finding similarity and distance
measurements in the images.
Also it is useful in pattern recognition or
classification

Covering
In a graph G, a set g of edges is said to cover G if
every vertex in G is incident on at least on one edge
in g.
The set of edges that covers a graph is said to be an
edge covering, a covering sub graph, or a covering
of G.
A spanning tree of a connected graph is also a
covering.
A Hamiltonian circuit in a graph is another covering.
The minimal covering in which no edge can be
removed without destroying its ability to cover the
graph.
Covering-Example
Heavy lines represents Covering
Covering - Observations
A covering exists for a graph iff the graph has no
isolated vertex.
A covering of an n-vertex graph will have at least n/2 (
edges.
Every pendant edge in a graph is included in every
covering of the graph.
Every covering contains a minimal covering.
If we denote the remaining edges of the graph by (G
g) , the set of edges g is a covering iff, for every vertex v,
the degree of vertex in (G g)s (degree of vertex v in G)-1

Covering - Observations
No minimal covering can contain a circuit. Therefore
a minimal covering of an n-vertex graph can contain
no more than n 1 edges.
A graph may have a number of coverings, and they
may have different sizes.
The number of edges in a minimal covering of the
smallest size is called the covering number of the
graph.
The Four Color Map Problem
This problem was only recently solved with the help
of computers. Previously, it was considered one of
the famous unsolved math problems!
The Four Color Map Problem
The Four Color Problem dates back to 1852. Francis
Guthrie, while trying to color the map of counties
of England, noticed four colors sufficed. He
wondered if it was true any map could be colored
using four colors in such a way that adjacent
regions receive different colors. Guthrie discussed
his conjecture with others and the Four Color
Problem escalated!
Analyze the fictional map representing 8 different
countries below.
A
B C
D
E
F
G
H
Can you name all the countries that share common
boundaries?
Countries sharing a common boundary with H: B, F, G
A
B C
D
E
F
G
H
Can you name the countries that share a common
vertex with H?

B, C, G
The goal of the Four Color Problem is to color
a map using no more than 4 colors. A map is
considered finished when it is correctly
colored with each country sharing a common
boundary having different colors. Countries
sharing common vertices may be colored
with the same color.

How many colors are needed?
2
Ex: yellow
Ex: red
How many colors are needed?
3
Ex: yellow
Ex: red
Ex: green
How many colors are needed?
2
Ex: blue
Ex: red
END
ALL UNITS COVERED

You might also like