Sunteți pe pagina 1din 55

Graph Theory

Lecture Series
CT-520

Mr. Umar Faryaz


Assistant Professor
Department Of Mathematics
1
Introduction to Graph Coloring
• When a map is colored, two regions with a common border are
customarily assigned different colors.
• We want to use the smallest number of colors instead of just
assigning every region its own color.

4-Color Map Theorem


• It can be shown that any two-dimensional map can be painted
using four colors in such a way that adjacent regions (meaning
those which sharing a common boundary segment, and not just a
point) are different colors.
Map Coloring

Four colors are sufficient to color a map of the


contiguous United States.
Dual Graph
• 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.
COLORIN
Maps and Dual Graphs

GRAPH
3.8
G
• Each map in the plane can be represented by a graph (Dual
Graph).
– Vertex: Region
– Edge: Region A and B have a common border
• Dual Graph is planar graph

B
B
G
C D
A C
F D G
A
E F

A map A Dual Graph E


COLORIN
Graph Coloring

GRAPH
3.8
G
• The problem of coloring the regions of a maps is equivalent to the
problem of coloring the vertices of the dual graph so that no two
adjacent vertices in the graph have the same color.
• The least number of colors needed for a coloring graph is given by
chromatic number which denoted by χ (G).
• The Chromatic number for planar graph is not greater that 4.

B Green
B
G
C red Yellow Blue C
Blue D G D
A
A F
F
Green E
A coloring
Dual Graph
E
with χ (G) = 4. red A coloring 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.

• Assignment of "colors" to certain objects in a graph subject to


certain constraints
– Vertex coloring
– Edge coloring
– Face coloring (planar)
Example
• What is the chromatic number of the graph
shown below?
The chromatic number
must be at least 3 since
b e
a, b, and c must be
a d g
assigned different colors.
So Let’s try 3 colors first.
c f
3 colors work, so the
chromatic number of this
graph is 3.
Example
• What is the chromatic number for each of
the following graphs?

White
White Yellow

Green Yellow
Yellow White

White Yellow Yellow White

Chromatic number: 2 Chromatic number: 3


Brook’s Theorem
If G is a connected graph other than a complete graph or an odd cycle,
(G)<=(G).

(G): The least k such that G is k-colorable.


(G): the maximum degree in G.
3

1
4 2
2
3
5 1

6
Vertex Coloring Examples
The problem says that, there are some people who belong to different
committees and each person might belong to more than one
committee. Now, the goal is to schedule the meeting of these
committees in such a way that the meetings are all finished in
minimum possible time. In, other words try to schedule the meetings
in such a way that, the maximum number of committees have
simultaneous meetings. But, the scheduling must be such that two
committees having a common member do not meet simultaneously,
so that each person can attend all his meetings.

We modeled this problem using a graph where each node represented


a committee and each edge represented one or more common
member between two committees. Then, we modeled the scheduling
problem as a coloring problem, where we have to color the
nodes/vertices in such a way that adjacent vertices have different
colors. Then, the committees whose corresponding vertices have
same color meets simultaneously.
Now, If we take a simple example - Let there are four committees
A,B,C and D. And A − B,A − C,B − D and C − D has common
members. So, the corresponding graph will look like

Committee Meeting Scheduling-Graph representation


After Applying Vertex Coloring we G

Committee Meeting Scheduling-Colored Graph

So, committee A and D has meetings together. And committee


B and C has meetings together.
Application: Scheduling Final Exams
How can the final exams at UMP be scheduled so that no student
has two exams at the same time?
Suppose that, 7 finals to be scheduled and the following pairs of
course have common students.
1&2, 1&3, 1&4, 1&7, 2&3, 2&4, 2&5, 2&7, 3&4,
3&6, 3&7, 4&5, 4&6, 5&6, 5&7, and 6&7

1 red

brown 7 2 blue Time Period Course


I 1, 6
II 2
red 6 3 green
III 3, 5
IV 4, 7

green 5 4 brown
Scheduling Problem
• Q. How many time periods are needed to offer the following courses
for the set of student schedules? Find the chromatic number.

• Course Listings:
Combinatory (C), Graph Theory (G), Linear Algebra (L),
Numerical Analysis (N), Probability (P), Statistics (S), Topology(T)

• Student Schedules:
CLT, CGS, GN, CL, LN, CG, NP, GL, CT, CST, PS, PT
Scheduling Times For Lectures
Suppose that you are responsible for scheduling times for lectures in
a university. You want to make sure that any two lectures with a
common student occur at different times to avoid a conflict. We
could put the various lectures on a chart and mark with an “X” any
pair that has students in common:
A more convenient representation of this information is a graph with
one vertex for each lecture and in which two vertices are joined if
there is a convict between them:

Now, we cannot schedule two lectures at the same time if there is a


conflict, but we would like to use as few separate times as
possible, subject to this constraint. How many different times
are necessary?
We can code each time with a color, for example 11:00-12:00
might be given the color green, and those lectures that meet at
this time will be colored green. The no-conflict rule then
means that we need to color the vertices of our graph in such a
way that no two adjacent vertices (representing courses which
conflict with each other) have the same color.
Question: Is there a proper coloring that uses less than four colors?
Clearly we cannot get by with less than three colors, since G, H,
and L are all adjacent to each other. So the question becomes: Can
we find a 3-coloring? The answer is negative. We shall suppose
that we can properly color the graph with only three colors, and
show that this leads to a contradiction. We start by coloring G, H,
and L three different colors, as we must. We might as well assume
they are the colors as shown above. Then M must be the same
color as H, since M is adjacent to G and L and there are only three
colors available. So we color M blue as shown above. In a like
manner, I must be colored green since it is adjacent to L and M,
which we have determined to be red and blue. Now S is adjacent
to H, L, and I, and so it must be a different color from them all. So
we cannot make do with only three colors. So four colors are
needed to properly color the graph.
Greedy Algorithm For Coloring Vertices
The Greedy Algorithm For Coloring Vertices. The algorithm is
called greedy because it is a rather short-sighted way of trying to
make a proper coloring with as few colors as possible. It does not
always succeed in finding the minimum number (the chromatic
number), but at least provides some proper coloring.
The procedure requires us to number consecutively the colors that
we use, so each time we introduce a new color, we number it also.
Here is the procedure:
1. Color a vertex with color 1.
2. Pick an uncolored vertex v. Color it with the lowest-numbered
color that has not been used on any previously-colored vertices
adjacent to v. (If all previously-used colors appear on vertices
adjacent to v, this means that we must introduce a new color and
number it.)
3. Repeat the previous step until all vertices are colored.
Graph Theory

Examples of Greedy Coloring Algorithm


Index
1 2 3 4 5

Coloring
3 5 Sequence
1

2 4

43
Ch.5. Coloring of Graphs
Edge Coloring
In graph theory, an edge coloring of a graph is an assignment of
“colors” to the edges of the graph so that no two adjacent edges have
the same color.
The figure below shows an edge coloring of a graph by the colors red,
blue, and green.
Edge chromatic index
The chromatic index gives the minimum number of colors with
which graph's edges can be colored.

For example, the edges of the graph above in the illustration can be
colored by three colors but cannot be colored by two colors, so the
graph shown has chromatic index three.
Petersen graph

A 3-coloring of the Petersen A 4-coloring of the Petersen


graph's vertices. The graph's edges. The Petersen
Petersen graph has graph has chromatic
chromatic number 3, index 4
Edge Coloring Examples
The Cricket League Problem states that there are 2n teams in a
cricket league. All teams play each other once. We have to schedule
the matches in such a way that a team never plays more than once in
a week. And the scheduling should also ensure that the League
finishes in as few weeks as possible.
We can model this problem using a graph by representing the teams
as vertices and the matches as edges. So, a league of 2n teams will
be converted to a Complete Graph with 2n vertices, K2n. Now the
scheduling problem, becomes a coloring problem, where we color
the edges. Edges having the same color denote matches played in a
certain week. So, we must ensure that two edges from the same
vertex never gets the same color.

In other words, we have to ensure that adjacent edges have different


color. And try to color the graph this way using as few color as
possible.
Taking a simple example of a league with 4 teams, we get the
following graph and the following coloring

Cricket League scheduling


Cricket League Scheduling: After Coloring
Applications of graph coloring
• assignment problems
• scheduling problems
• matching problems
• map coloring and the Four
Color Problem
Vertex Coloring vs. Edge Coloring

Vertex Coloring partitions the graph into Independent Sets, each set containing
only mutually non-adjacent vertices. On the other hand Edge Coloring partitions
the graph into Matching's.

Multiple edges between two vertices has no consequence in Vertex Coloring. But
it increases the required number of colors for Edge Coloring.

The edge-chromatic number is denoted as χ' (G). And The chromatic number for
Vertex Coloring is denoted as χ (G)

Which problems can be modeled as Vertex Coloring and which are better suited
for Edge Coloring? Clearly, if one of these can be applied, then the other one can
be applied too. A problem can be converted from a Vertex Coloring problem to an
Edge Coloring problem using Line Graphs. So, there is no rule stating that this
problem is good for Vertex Coloring and that one for Edge Coloring.

S-ar putea să vă placă și