Chapter - 4 - Graph Theory - Part - 3
Chapter - 4 - Graph Theory - Part - 3
ANUJ GHIMIRE
DISCLAIMER
This document does not claim any originality and
cannot be used as a substitute for prescribed textbooks.
The information presented here is merely a collection
from various sources as well as freely available material
from internet and textbooks.
The ownership of the information lies with the
respective authors or institutions.
Chapter 4_Part_3
Graph Theory
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.
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
Statement: The chromatic number of a planar graph is
no greater than four.
• Four colors are sufficient to color a map of the contiguous United States.
• Source of map: http://www.math.gatech.edu/~thomas/FC/fourcolor.html
Graph Coloring
What is the chromatic number of the graph shown
below?
b e
a g
d
c f
Graph Coloring
The chromatic number must be at least 3 since a, b, and c
must be assigned different colors.
So Let’s try 3 colors first. 3 colors work, so the chromatic
number of this graph is 3.
b e
a d g
c f
Example
What is the chromatic number for each of the following
graphs?
White
White Yellow
Green Yellow
Yellow White
B E H
C F I
In the above figure, there are two sources A and C and three destinations G, H, and I.
Network Flow
Then, the equivalent network flow with single source S and single destination D is as
shown in figure.
A J G
S B E H D
C F I
Flows
The resources that transport along any edge is known as
flow.
Let us label edges with two components as (c(e), f(e))
where c(e) is the capacity of edge and f(e) is the
amount of flow through that edge.
The two criteria are:
The amount of flow can't exceed the capacity of that edge.
For every node (except S & D), the amount of flow flowing
into vertex v (incoming flow) must be equal to the amount
of flow flowing out of vertex v which is also called flow
conservation.
Flows
(10,7)
A G
(15,13) (13,13)
(9,6) (5,1)
(10,5)
S B E D
(9,3) (9,2)
(8,6)
(15,9) (8,4)
(7,7)
C F
(10,3)
Incoming flow at B = 6 + 6 = 12
Outgoing flow at B = 5 + 3 + 4 = 12
(15,11) (10,10)
(5,4)
(7,7) (4,2)
S (15,6) E D
B
(10,4)
(7,7) (4,0)
(15,10) (5,4)
(10,7)
C G
(7,3)
Solution,
To compute the maximum flow in the given network , we use following
steps:
First we identify the augmenting path
Second we increase flow along that augmenting path
Repeat above steps until the maximum flow is obtained.
For augmenting path we first look for forward unsaturated edge.
Here different forward edges from S to G are:
SAFD
SABFD Among the given forward edges the
SABED only unsaturated augmenting path is
SABGD S C G D
SABEFD All other path has the A B, C B
and F D i.e. saturated flow
SCBED (capacity=flow).
SCBGD
SCBEGD
SCGD
To increase the flow along that augmenting path, we need to
compute the slack (the value that can be added to the flow of
augmented path).
We have S C G D as the augmenting path
Now Slack (S,C) = Capacity – Flow
= 15-10
=5
Again Slack (C,G) = Capacity – Flow
= 7-3
=4
Also Slack (G,D) = Capacity – Flow
= 10-7
=3
Among the slack (5, 4, 3) the minimum is 3. So, add 3 to all the flow
in the augmenting path
The network flow becomes as follows:
(9,4)
A F
(15,11) (10,10)
(5,4)
(7,7) (4,2)
S (15,6) E D
B
(10,4)
(7,7) (4,0)
(15,13) (5,4)
(10,10)
C G
(7,6)
Again,
We need to look for augmenting path, first check if there are any
forward unsaturated edge.
Here different forward edges from S to G are:
SAFD
SABFD
SABED Among the given forward edges the
there are no any unsaturated
SABGD augmenting path
SABEFD All path has the A B, C B, F D
and G D i.e. saturated flow
SCBED (capacity=flow).
SCBGD
SCBEGD
SCGD
So,
We need to look for augmenting path with some backward edge.
Different augmenting path with backward edges from S to G are:
SAFBED
SAFED
SCGBED
Among the given backward edges the
SCGED
augmenting path SCGED
cannot be proceed as G E has the
flow value 0.
Now, we can proceed with any of the augmenting path with backward
edge.
We first continue with SAFBED
To increase the flow along that augmenting path, we need to
compute the slack (the value that can be added to the flow of
augmented path).
We have SAFBED as the augmenting path
Now, Slack (S, A) = Capacity – Flow = 15-11 = 4
Again, Slack (A,F) = Capacity – Flow = 9-4 = 5
Also, Slack (F,B) = 4
Here F B is the backward edge so the slack value is same as
the flow value i.e. 4
Similarly, Slack (B,E) = Capacity – Flow = 15-9 = 9
Finally, Slack (E,D) = Capacity – Flow = 10-4 = 6
Among the Slack (4, 5, 4, 9, 6) the minimum is 4. So, add 4 to all the
flow in the forward augmenting path and subtract 4 in the backward
edge.
The network flow becomes as follows:
(9,8)
A F
(15,15) (10,10)
(5,0)
(7,7) (4,2)
S (15,10) E D
B
(10,8)
(7,7) (4,0)
(15,13) (5,4)
(10,10)
C G
(7,6)
Again, we have augmenting path with backward edge as:
SAFED
SCGBED
Now we cannot choose SAFED because SA becomes
saturated flow as capacity=flow.
Now, we proceed with SCGBED
To increase the flow along that augmenting path, we need to
compute the slack (the value that can be added to the flow of
augmented path).
We have SCGBED as the augmenting path
Now, Slack (S, C) = Capacity – Flow = 15-13 = 2
Again, Slack (C,G) = Capacity – Flow = 7-6 = 1
Also, Slack (G,B) = 4
Here F B is the backward edge so the slack value is same as
the flow value i.e. 4
Similarly, Slack (B,E) = Capacity – Flow = 15-10 = 5
Finally, Slack (E,D) = Capacity – Flow = 10-8 = 2
Among the Slack (2, 1, 4, 5, 2) the minimum is 1. So, add 1 to all the
flow in the forward augmenting path and subtract 1 in the backward
edge.
The final network flow becomes as follows:
(9,8)
A F
(15,15) (10,10)
(5,0)
(7,7) (4,2)
S (15,11) E D
B
(10,9)
(7,7) (4,0)
(15,14) (5,3)
(10,10)
C G
(7,7)
(8,4) (7,4)
S D
(7,5)
(6,5)
B E
(5,5)
Solution,
To compute the S-D cut in the given network, we will divide the
network into two halves 𝑋 and 𝑋ത where:
Source vertex S ∈ 𝑋
Sink vertex D ∈ 𝑋ത
Different possible S-D cuts are obtained by dividing the network into
two half as:
First we divide the network where Source lies in one set and all
other nodes including Sink in the other set.
We then divide the set with all possible combination where two
node including Source will be in first set and remaining node
including Sink in second set.
We then divide the set with all possible combination where
three node including Source will be in first set and remaining
node including Sink in second set.
We continue until all node except Sink in first set and Sink in
second set.
There is path from S to A and S
to B so we make that pair and
Different possible S-D cuts are with capacity are: add the capacity of each pair
𝑋 𝑋ത (𝑋, 𝑋ത ) K(𝑋, 𝑋ത )
{S} {A,B,C,E,D} {(S,A),(S,B)} 8+7=15
{S,A} {B,C,E,D} {(S,B),(A,C)} 7+4=11
{S,B} {A,C,E,D} {(S,A),(B,E)} 8+5=13
{S,A,B} {C,E,D} {(A,C),(B,E)} 4+5=9
{S,A,C} {B,E,D} {(S,B),(C,D)} 7+7=14
{S,A,E} {B,C,D} {(S,B),(A,C),(E,D)} 7+4+6=17
{S,B,C} {A,E,D} {(S,A),(B,E),(C,D)} 8+5+7=20
{S,B,E} {A,C,D} {(S,A),(E,D)} 8+6=14
{S,A,B,C} {E,D} {(B,E),(C,D)} 5+7=12
{S,A,B,E} {C,D} {(A,C),(E,D)} 4+6=10
{S,A,B,C,E} {D} {(C,D),(E,D)} 7+6=13
From the above table the minimum capacity of S-D cut is 9
Example_2
Find the maximum flow in the given transport
network using S-D cut method
5
U W
3 5
4 7
S 9 D
2 5
V X
6
Solution,
The maximum flow can also be computed using the S-D cut.
There is a Theorem as Max Flow Min Cut which states: In any flow
(transport) network, the value of any maximal flow is equal to
the capacity of a minimal cut.
So, we compute the S-D cut in the given network, which will be the
maximum flow in that network.
Different possible S-D cuts are obtained by dividing the network into
two half as:
First we divide the network where Source lies in one set and all
other nodes including Sink in the other set.
We then divide the set with all possible combination where two
node including Source will be in first set and remaining node
including Sink in second set.
We then divide the set with all possible combination where
three node including Source will be in first set and remaining
node including Sink in second set.
We continue until all node except Sink in first set and Sink in
second set.
Different possible S-D cuts are with capacity are:
𝑋 𝑋ത (𝑋, 𝑋ത ) K(𝑋, 𝑋ത )
{S} {U,V,W,X,D} {(S,U),(S,V)} 3+2=5
{S,U} {V,W,X,D} {(S,V),(U,W),(U,V)} 2+5+4=11
{S,V} {U,W,X,D} {(S,U),(V,W),(V,X)} 3+7+6=16
{S,W} {U,V,X,D} {(S,U),(S,V),(W,D)} 3+2+5=10
{S,X} {U,V,W,D} {(S,U),(S,V),(X,W),(X,D)} 3+2+9+5=19
{S,U,V} {W,X,D} {(U,W),(V,W),(V,X)} 5+7+6=18
{S,U,W} {V,X,D} {(S,V),(U,V),(W,D)} 2+4+5=11
{S,U,X} {V,W,D} {(S,V),(U,V),(U,W),(X,W),(X,D)} 2+4+5+9+5=25
{S,V,W} {U,X,D} {(S,U),(V,X),(W,D)} 3+6+5=14
𝑋 𝑋ത (𝑋, 𝑋ത ) K(𝑋, 𝑋ത )
{S,X,V,} {U,W,D} {……..} ……
…… …… …… ……
…… …… …… ……
{S,U,V,X} {W,D} {(U,W),(V,W),(X,D)} 5+7+5=17
{S,U,V,W} {X,D} {(V,X),(W,D)} 6+5=11
…… …… …… ……
…… …… …… ……
{S,U,V,X,W} {D} {(X,D),(W,D)} 5+5=10