1
00:00:01,000 --> 00:00:02,250
Welcome back.
2
00:00:02,250 --> 00:00:09,840
So we have been looking at how to model the
problems using Linear Programming and Graph
3
00:00:09,840 --> 00:00:10,840
theory.
4
00:00:10,840 --> 00:00:19,590
So the basic idea is that if we have to solve
the problem or if we have to attack the problem
5
00:00:19,590 --> 00:00:25,470
one of the easy ways is to convert it in a
Mathematical language that is well studied.
6
00:00:25,470 --> 00:00:33,640
In that ways you can use the known Mathematical
tools or use the Mathematical tools to solve
7
00:00:33,640 --> 00:00:35,640
the problem.
8
00:00:35,640 --> 00:00:42,079
There are various Mathematical languages which
can be used to model a problem.
9
00:00:42,079 --> 00:00:50,290
For discrete problems two of the more powerful
techniques are Graph theory and Linear Programming.
10
00:00:50,290 --> 00:01:01,090
So in the last couple of videos we have looked
at some problems and how to solve them using
11
00:01:01,090 --> 00:01:02,100
Linear Programming.
12
00:01:02,100 --> 00:01:10,340
Now in this video, we are back to Graph theory
and we will see how one can use it to solve
13
00:01:10,340 --> 00:01:14,240
the problems using Graph theory.
14
00:01:14,240 --> 00:01:17,380
So to quickly revise what a graph is?
15
00:01:17,380 --> 00:01:20,850
A graph is something like this.
16
00:01:20,850 --> 00:01:28,180
We have a set of vertices and the set of edges
which are basically arrows or lines between
17
00:01:28,180 --> 00:01:30,360
the set of vertices.
18
00:01:30,360 --> 00:01:36,630
The vertices represent certain objects or
state or something like that.
19
00:01:36,630 --> 00:01:44,740
The edges represent relationship between the
vertices so binary relations in particular
20
00:01:44,740 --> 00:01:53,450
and using this model of, this kind of a structure
we can represent various problems.
21
00:01:53,450 --> 00:02:02,549
So, for example, this is a set of vertices
and this is a set of edges that we have, right.
22
00:02:02,549 --> 00:02:08,459
Of course, very advantage of a graph is that
is it is simple and is very general.
23
00:02:08,459 --> 00:02:15,440
It is used for representing expressing binary
relations among objects.
24
00:02:15,440 --> 00:02:18,100
We have seen some of the examples already.
25
00:02:18,100 --> 00:02:25,320
A typical example is a friendship graph where
every person is a vertex and if two persons
26
00:02:25,320 --> 00:02:32,080
are friends then there is an edge between
the respective vertices and we get a friendship
27
00:02:32,080 --> 00:02:33,810
graph using this technique.
28
00:02:33,810 --> 00:02:45,099
Or we can have directed graphs when the relationship
is not reflexive.
29
00:02:45,099 --> 00:02:52,019
In that case, we can add edges in one direction
I mean the edges can have direction and we
30
00:02:52,019 --> 00:02:55,860
call directed graphs.
31
00:02:55,860 --> 00:03:01,659
So the edges can have directions and we have
what we call as directed graphs.
32
00:03:01,659 --> 00:03:10,250
Now typical example of a directed graph is
the internet graph where every website is
33
00:03:10,250 --> 00:03:11,590
a vertex.
34
00:03:11,590 --> 00:03:19,239
And if there is a link from a website to another
website it is a directed graph and we get
35
00:03:19,239 --> 00:03:24,010
the internet graph which is used a lot by
various search engines.
36
00:03:24,010 --> 00:03:27,620
So this is for example particular kind of
directed graphs.
37
00:03:27,620 --> 00:03:36,319
This is aa shot of a internet graphs.
38
00:03:36,319 --> 00:03:42,659
We can also have weights on the edges and
in that case we have weighted directed graph.
39
00:03:42,659 --> 00:03:50,879
For example, we can have weights like this
and we get a weighted directed graph.
40
00:03:50,879 --> 00:04:00,360
For example, in the cases of road networks
we can have vertices that are cities edges
41
00:04:00,360 --> 00:04:04,560
that are roads and the weights can represent
the distance between two vertices.
42
00:04:04,560 --> 00:04:11,480
For example, distance between Amsterdam to
Berlin is 690 miles and so on.
43
00:04:11,480 --> 00:04:18,180
Similarly, air connectivity, we can have if
there is a vertices or airports and whether
44
00:04:18,180 --> 00:04:26,740
there is an edge between them one vertex to
the another if there is a flight between those
45
00:04:26,740 --> 00:04:27,740
two vertices.
46
00:04:27,740 --> 00:04:37,669
Typical example you can see it in almost any
airplane this map is usually there it is a
47
00:04:37,669 --> 00:04:40,479
directed map of the air connectivity.
48
00:04:40,479 --> 00:04:43,090
(Refer Slide 04:45)
49
00:04:43,090 --> 00:04:52,160
There are many other problems that can be
converted into Graph theory and hence studying
50
00:04:52,160 --> 00:04:58,970
structure of graph and designing algorithms
for graphs is an very important field.
51
00:04:58,970 --> 00:05:04,400
A formal definition we have seen this thing
a many times we can have vertices which is
52
00:05:04,400 --> 00:05:09,870
set of elements, edges which are pairs of
objects, pairs of vertices.
53
00:05:09,870 --> 00:05:17,820
The graph is given as the vertex and the edge
and there can be the edges can be weighted.
54
00:05:17,820 --> 00:05:19,970
Namely, there can be weights on every edge.
55
00:05:19,970 --> 00:05:26,600
So there is a weight function from the edge
set to the real numbers.
56
00:05:26,600 --> 00:05:33,650
Now using all these things let us try to first
solve the problem of the telephone tower problem
57
00:05:33,650 --> 00:05:38,410
that we spoke about last video.
58
00:05:38,410 --> 00:05:50,020
So here basically you have N important locations
and we want to ensure that all the N important
59
00:05:50,020 --> 00:05:52,850
locations have 3G network.
60
00:05:52,850 --> 00:06:03,300
So for that to ensure that a location has
3G network we have to first upgrade some of
61
00:06:03,300 --> 00:06:08,770
the towers, upgrade the infrastructure of
some of the towers and every of this N location
62
00:06:08,770 --> 00:06:14,319
must be in a distant less than 1 kilometer
from at least one towers.
63
00:06:14,319 --> 00:06:27,620
And it is still an optimization problem because
we want to minimize the number of towers we
64
00:06:27,620 --> 00:06:30,430
want to optimize.
65
00:06:30,430 --> 00:06:35,320
Now let us try to model it as graphs.
66
00:06:35,320 --> 00:06:39,310
So let the important locations hence the v1
to vn and the towers be in location T1 to
67
00:06:39,310 --> 00:06:40,310
TK.
68
00:06:40,310 --> 00:06:48,960
And if two of the locations are in distance
1 kilometer then we will draw an edge between
69
00:06:48,960 --> 00:06:49,960
them.
70
00:06:49,960 --> 00:06:57,821
So the vertex set is V1 to VN and T1 to TK
and if there is a location if two locations
71
00:06:57,821 --> 00:07:02,630
are close to less than 1 kilometer distance
we draw a edge between them.
72
00:07:02,630 --> 00:07:10,940
By doing so, we get a graph of this sort something
like this where the red vertices are the tower
73
00:07:10,940 --> 00:07:18,430
locations and the gray vertices are the non
tower locations now what is it that we want.
74
00:07:18,430 --> 00:07:20,790
Now what does this graph say?
75
00:07:20,790 --> 00:07:33,099
It says that this vertex A is distance less
than 1 kilometer from D, but this for example
76
00:07:33,099 --> 00:07:43,220
the vertex J is distance 1 kilometer from
both C and E. So if A has to get the 3G connection
77
00:07:43,220 --> 00:07:50,620
then D must be upgraded whereas if J has to
get a 3G connection either C or E has to upgraded
78
00:07:50,620 --> 00:07:52,289
and so on.
79
00:07:52,289 --> 00:07:59,590
Now clearly particularly this is a toy example
in the sense that the graph is not an original
80
00:07:59,590 --> 00:08:04,979
graph, so it does not –exactly show all
the complexities of this problem.
81
00:08:04,979 --> 00:08:17,110
But the main idea is we have to pick a set
of red edges Red vertices such that for all
82
00:08:17,110 --> 00:08:21,910
vertices in the graph at least one neighbor
is picked, one of the red neighbours is picked
83
00:08:21,910 --> 00:08:26,380
and we want to minimize the number of vertices
picked.
84
00:08:26,380 --> 00:08:41,060
Now this is a typical problem we call it as
a Vertex Cover Problem, but this is just a
85
00:08:41,060 --> 00:08:48,630
formulation of the problem how do you come
and solves the minimum vertex cover problem
86
00:08:48,630 --> 00:08:51,050
is a different matter altogether.
87
00:08:51,050 --> 00:08:59,080
So here I have used the graph tools, write
it down as Vertex Cover Problem.
88
00:08:59,080 --> 00:09:01,540
Now how do you solve them?
89
00:09:01,540 --> 00:09:10,100
So first of all, one thing you do is that
we can now use LP formulations on top of this.
90
00:09:10,100 --> 00:09:17,459
So, for example define for every vertex which
is red let me define the variables XC, XD,
91
00:09:17,459 --> 00:09:25,670
and XE representing whether I choose that
vertex or not which is 1 if I choose the vertex
92
00:09:25,670 --> 00:09:26,670
0 otherwise.
93
00:09:26,670 --> 00:09:34,320
Now if I do it like that how do I ensure that
all the vertex have at least one neighbour
94
00:09:34,320 --> 00:09:35,320
picked.
95
00:09:35,320 --> 00:09:42,540
So that means take a vertex say B and if it
has neighbour C,B and E then we have to ensure
96
00:09:42,540 --> 00:09:45,060
that XD+XC +XE > 1.
97
00:09:45,060 --> 00:09:50,779
This ensures that since the XC, XD, XG, XE
is 0 or 1.
98
00:09:50,779 --> 00:10:01,600
This can be greater than 1 only if one of
them is 1 which means one of its neighbours
99
00:10:01,600 --> 00:10:02,600
is picked.
100
00:10:02,600 --> 00:10:15,020
So if we basically put the condition that
for all vertex B this holds then we have the
101
00:10:15,020 --> 00:10:18,339
condition, the whole condition.
102
00:10:18,339 --> 00:10:19,829
And we are trying to minimize something.
103
00:10:19,829 --> 00:10:28,930
The minimization is of course we have to minimize
sum over all the number of things that we
104
00:10:28,930 --> 00:10:34,210
are picking upNote that here we picked up
the problem converted into a graph problem
105
00:10:34,210 --> 00:10:40,420
and kind of helped us to visualize what is
going on and that what helped us to write
106
00:10:40,420 --> 00:10:41,430
the LP formulation of this.
107
00:10:41,430 --> 00:10:47,690
Now this is a of course a Vertex Cover Problem
and it is very well studied problem.
108
00:10:47,690 --> 00:10:52,570
And hence there is a big literature on this
particular problem also.
109
00:10:52,570 --> 00:10:59,399
But in any case now that we have done it we
have a set of variables.
110
00:10:59,399 --> 00:11:09,390
We want to minimize something such that this
thing holds and the variables are 0 and 1
111
00:11:09,390 --> 00:11:14,560
and this is exactly the LP formulation of
this problem.
112
00:11:14,560 --> 00:11:23,440
Again as you might recall this is not exactly
LP formulation because it has the variables
113
00:11:23,440 --> 00:11:28,709
is not from r but it is from 0 and 1.
114
00:11:28,709 --> 00:11:36,209
And hence we do not know how to solve this
particular problem exactly.
115
00:11:36,209 --> 00:11:39,190
So we have to solve this variable.
116
00:11:39,190 --> 00:11:44,570
Unfortunately, it is an integer Linear Programming
and we might have to apply things like randomization
117
00:11:44,570 --> 00:11:56,290
or the rounding technique that we talked about
last class to solve it.
118
00:11:56,290 --> 00:12:02,490
Of course, we can relax the LP to get relax
this condition to get Xi’s to be the real
119
00:12:02,490 --> 00:12:08,209
number between 0 and 1 in that case we get
a real T we can solve it.
120
00:12:08,209 --> 00:12:18,880
And then we can use the usual technique that
we did last time to solve it.
121
00:12:18,880 --> 00:12:28,480
Now the main point here is not how to solve
it, but the fact that we can take the problem,
122
00:12:28,480 --> 00:12:31,170
use Graph theory to model it or visualize
it and then use Linear Programming to model
123
00:12:31,170 --> 00:12:34,050
that problem into a defined setups.
124
00:12:34,050 --> 00:12:40,339
Now let moving on to an another problem.
125
00:12:40,339 --> 00:12:42,670
Here is the scheduling problem that we have.
126
00:12:42,670 --> 00:12:51,110
Here we have this 6 meetings that we have
and the HR has to ensure what is the least
127
00:12:51,110 --> 00:13:00,260
number of room to book such that it can arrange
for the meetings to be held in different rooms
128
00:13:00,260 --> 00:13:07,139
so that there is no confusion or rather two
meetings which are clashing in time does not
129
00:13:07,139 --> 00:13:09,079
happen in this same room.
130
00:13:09,079 --> 00:13:14,310
What is the minimum number of rooms to meet
that?
131
00:13:14,310 --> 00:13:23,800
Now again we can use Graph theory to solve
this or to model this problem.
132
00:13:23,800 --> 00:13:31,480
So here we represent every meeting as a vertex
and we draw an edge between two vertices if
133
00:13:31,480 --> 00:13:41,649
there is a clash in time and we want to slot
them in different rooms so that if there is
134
00:13:41,649 --> 00:13:47,540
an edge between two vertices they happen in
two different rooms.
135
00:13:47,540 --> 00:13:54,120
So in other words, we want to colour the vertices
using as little as less number of colours
136
00:13:54,120 --> 00:13:55,120
as possible.
137
00:13:55,120 --> 00:14:00,910
And this is what of course we have done this
problem it is the famous Chromatic Number
138
00:14:00,910 --> 00:14:03,440
of Graphs.
139
00:14:03,440 --> 00:14:09,790
So in other words, we want to kind of assign
the vertices to rooms in other words colours
140
00:14:09,790 --> 00:14:12,589
such that no two adjacent vertex has the same
colour.
141
00:14:12,589 --> 00:14:23,660
Question is that, what is the minimum number
of colours required to colour the graphs?
142
00:14:23,660 --> 00:14:30,390
So if this is the vertex of course if we colour
if we assign this one to the Red room then
143
00:14:30,390 --> 00:14:37,420
B must be assigned to some other room which
is the blue room and then C can be assigned
144
00:14:37,420 --> 00:14:44,130
to the Red room again then D has to be assigned
to a new room cannot be assigned to Red and
145
00:14:44,130 --> 00:14:50,250
Blue because A and B are of Red and Blue and
similarly you go on and we can assign various
146
00:14:50,250 --> 00:14:52,780
vertices to the various rooms.
147
00:14:52,780 --> 00:14:56,010
Question is that what is the minimum number
of colours required to colour this graphs?
148
00:14:56,010 --> 00:15:04,459
The application of course as I have pointed
out is available in various coloring of map
149
00:15:04,459 --> 00:15:05,480
and so on.
150
00:15:05,480 --> 00:15:14,790
Now the main idea that I wanted to convey
in this few video lectures is that many problems
151
00:15:14,790 --> 00:15:17,220
can be modelled as graph problems.
152
00:15:17,220 --> 00:15:21,740
Some can be modelled using Linear Programming
or optimization problem.
153
00:15:21,740 --> 00:15:26,290
There is lot of technique in literature to
solve this problem.
154
00:15:26,290 --> 00:15:31,680
One important thing to notice how to model
this problem in a Mathematical way, in different
155
00:15:31,680 --> 00:15:33,019
Mathematical language.
156
00:15:33,019 --> 00:15:40,680
Once, you know, how to write it in a different
language then you can use tools from other
157
00:15:40,680 --> 00:15:43,980
techniques to solve it.
158
00:15:43,980 --> 00:15:51,510
We have seen Graph theory and Linear Programming
both of them are a subject by itself of whole
159
00:15:51,510 --> 00:15:53,339
course subjects.
160
00:15:53,339 --> 00:16:01,790
So I cannot go too much into details of Graph
theory and Linear Programming, but here the
161
00:16:01,790 --> 00:16:10,240
main point is that learning how to convert
a problem into a Graph theory problem or a
162
00:16:10,240 --> 00:16:15,980
Linear Programming problem or in some other
language is a very important and essential
163
00:16:15,980 --> 00:16:17,560
tool to have.
164
00:16:17,560 --> 00:16:26,070
In the next video, we will look at other aspects
of this map you will be moving away from Graph
165
00:16:26,070 --> 00:16:26,640
theory.