 Let me give you another application which is again a very popular application and also very revealing one. So, this is the famous Max-Floem in-cut theorem. So, what is this theorem about? So, essentially just imagine you have a network say, let me draw one network here comprising of just 5 nodes, node 1, node 2, this is node 3, node 4, this is node 5 and I can, there are links in this links or edges in this network and these are directed edges. So, means they denote what direction you can travel on this link. Some links are bi-directional. So, like this 3 to 4 you can travel from in either direction and now these links all have capacities. Capacities means they say it tells you how much flow or how much material or how much data whatever can flow on this on that particular link. So, let me just write them here. So, suppose capacity from 1 to 4 is say 10, capacity from 1 to 3 is 20, capacity from 1 to 20, 1 to 2 is 30, say 2 to 5 is say 5, this is suppose 10 again, this is 15 suppose here. So, from 4 to 3 is 15, from 3 to 4 is 20 suppose, etc. So, I have just put in some numbers here from 4 to 5 is 5 again, etc. So, this is what the, so what this means is this, the setting is as follows. You have this network of nodes, this network you can imagine as a network of say computers and you have data at say computer 1, here this is where you have data and you would want that data to eventually reach computer 5. So, suppose you have you are changing your mobile phone, you have your old mobile phone and you have your new mobile phone, you want to transfer data from your old mobile phone to the new mobile phone. So, the old one is node 1, the new one is node 5 and you have various possible means by which you can transfer this data. You can for example move some, there is one means which is to go through this intermediate thing say go through say Wi-Fi, a Wi-Fi connection that will connect you to 2 then take you to 3 and then it will go to 5 or from 2 it will go directly to 5 to your new mobile phone or maybe you can use a near field transfer to that could be another means you could have another third means in which you can you can copy a some of it on to say a USB disk and then move that back to the new phone etc. These are all basically different parts by which data can potentially go from your old phone, your old phone to the new phone. The question asked is what is the maximum data flow you can get? What is the maximum flow of data? How many MBs per second for instance from 1 to 5? Now you can see what the complication here is. So, if you look at 1 here flow is going to originate from 1, it is going to go out of 1, the links that go out of 1, they have capacities 10, 20, 30. So, you may think that well on the face of it you may think that you can send 60 MBs per second suppose these are suppose MBs per second. So, 10 MB per second here 20 MB per second here 30 MB per second you may think that that is what you can send out that is what you can send out of node 1, but then that data will later have to pass through this network and where the links are themselves where it will depend on how what the link capacities are there are. The link capacity is downstream could be very small like for example this link from 4 to 5 has a capacity of just 5. So, even though you are pumping in 60 MB per second here it may not actually go the links downstream may not be able to support that kind of data flow because they do not have that capacity. So, whenever whatever data reaches 4 only 5 MB per second can go to 5 along this link that is a limitation. Similarly, only 15 can go from 4 to 3. So, you can say basically the outflow from 4 is at most 15 plus 5 which is 20. Yes, so one of the assumptions we will make is that there is no storage of data in the sense that this is all whatever comes in has to go out at the time scales that we are talking about whatever comes in goes out. So, there is no these links are not storing data. So, in that case the question really is if you want to look at if you want to know what is the maximum flow of data from 1 to 5 the answer to that comes down to somehow trying to figure out what the bottleneck is in this entire network. Where in this network are you going to encounter the bottleneck means that where you cannot what is the really the what is it that is throttling your the flow of your data and that is basically what this particular result actually tells you. So, now this problem of finding the maximum flow from 1 to 5 we can write this as a linear program. So, let us just look at let us see how we can write this as a linear program. So, for simplicity let me suppose V is the flow that comes into 1 here and so V would also be the flow that goes out of 5 because no data is stored that is the flow that we will get out of 5. So, my convention would be that any inflow would so xij will denote flow from i to j and V is going to denote an inflow. So, at node 5 V will be an outflow. So, we will denote it as minus V minus V is therefore the outflow. So, what is the objective then the objective is to maximize this value V which is maximize the value of V subject to what constraints what are the constraints for us the constraints are that we have flow there are two types of constraints the first is a flow conservation constraint whatever comes in must go out whatever comes into any node must go out of that node. So, that is a flow conservation constraint flow conservation and the second is the constraint that you cannot exceed the capacity of the flow on any link cannot exceed the capacity of that particular link if flow cannot exceed the capacity. So, what is the let us write out flow conservation we do not need to write it for this particular network that I have drawn let us write it more generally for any network. So, my network let me denote it as a graph with vertices V and edges E. So, V is my are my vertices or nodes edges E are these E consists of all the edges all directed links or edges. So, the flow conservation essentially says if I look at x j i so and I sum this over j, j such that j comma i is an edge or a link in the graph what is this referring to what is this quantity in terms of my notation my notation was x i j is the flow from i to j. So, what is x j i this is the flow from j to i. So, as I and I sum this over all j which have which have a link incoming link to node i this is this is the inflow into node i. So, this is inflow into node i minus let us do this summation over j again x i j j such that now i comma j is an is a link in the network. So, this is all the outflow from from node i this is this is the outflow from node i this is outflow what should this be equal to. Now, if you are at if you if you are considered node 1 let us say let us suppose I want to transfer data from a nodes we want to transfer or flow from if you want to get flow from from from a node s to a node t. So, at node s which is your origin node at node s this right hand side would be equal to what would this right hand side be equal to this is the net flow in terms. So, at node s there will be there is going the inflow is only this way this value v right. So, this will be equal to therefore minus v for for i equal to s at every other node the inflow and outflow should be equal. So, this would be equal to 0 for i not equal to s and i not equal to t and at node and at node t which is where you want the flow to end up at node t this right hand side would be equal to v. So, with my with my fictitious flow here we added here you can see this is I can always write my write my flow conservation in this way. So, v is the flow that is coming in all these all these are the flows that are going out likewise minus v is the flow that that goes out and these are all the flows that come in. Then I have my constraint that my that my my flow cannot exceed capacity in the in the network I cannot exceed the capacity. So, this xij has to be less than equal to the capacity of link ij and finally xij has to be greater than equal to 0. So, you can see this gives me the following linear program let me just write it neatly here you have your maximizing v over variables v and all these xijs subject to the constraint that subject to these constraint xji sum over j where j i is an edge minus xij sum over j where ij is an edge is equal to v for i so equal to minus v for i equal to s 0 for i equal to s i not equal to s comma i not equal to t and and v for i equal to t and xij less than equal to the capacity of link ij and xij greater than equal to 0. So, this is now this is my the solution of this problem will give me the maximum flow that I can send from node s to node t. Now, if you write out the dual of this problem it turns out that the dual takes this particular form. So, if you write out the dual of this problem it takes this form the dual now it has variables wij one for one for each link and in addition to that it has these variables ui ui one for each node and the way they are written is so the and the objective is this summation cij not cij let us write it as cap ij cap ij times wij so capacity of link ij times wij is the objective subject to the constraint that uj minus ui plus wij is greater than equal to 0 for all links ij us minus ut is greater than equal to 1 wij is greater than equal to 0. So, this becomes the dual of this of the problem that we have written about. So, you take your you take the max flow problem which write that as a LP. Now, this LP is not in standard form, but you can convert it to standard form as a minimization LP in standard form then use the standard form dual and then you will get back to this particular problem. This is how you get to the to the dual of the earlier problem of the of the max flow problem and if you analyze this it can you tell me what would this amount to what would be the solution of this LP of the dual LP. So, if the solution of this dual LP is actually has a excellent has a beautiful interpretation it gives you what is called the minimum cut the minimum cut separating s and t. So, let me explain what that means. So, remember what I told you about the maximum flow problem the maximum flow problem is essentially comes down to finding the bottleneck in the network. Essentially it is if you are if you have an understanding of the bottleneck in the network like how much that gives you a sense of how much flow it can potentially send you can potentially send you. But if you look at the way we have posed this problem the way the max flow problem has been posed there is no mention at all of any bottlenecks or anything like that. But you can but the way that manifests itself is actually through the dual. So, what is what is the what is a cut separating s and t. So, let me explain that so if suppose this is my node 1 is my source node t is my destination node which is 5 a cut separating these two is just is a subset. So, what I do is I just to I can cut the graph in this sort of way in such a way that the vertices are divided into two sets one set one set that contains my source node the complement contains my this destination node. So, if I take my all my so a cut is a subset s of my vertices or a my nodes such that the source node lies in s and the destination node lies in s complement. So, look at look so what is a cut here for example this cut this is a cut if I if I say for example I can take 1 4 and 2 the vertices 1 4 and 2 that form the cut. So, 1 4 2 are has my source node 1 and then it is complement which is 3 and 5 has my destination. But I can create other cuts also like for example I can create a cut like this I can keep only 5 in my in that on the destination side. So, I have my cut can be 1 2 3 and 4. So, 1 2 3 4 can be a cut because that contains my source and 5 which is the complement that contains my destination. So, that is also a cut another cut is is this one where I keep only 1 in my set s and then 2 3 4 and 5 are all in the in the destination set on the that contains my destination node p. So, these are all possible different cuts right. So, the min cut so the so if I ask you what is the minimum cut minimum capacity of a cut what that means is look at the edges that are going across going across the cut that means edges that have one node in one set and the other node in the other set. So, the capacity of the cut equal to is the sum of the capacities of ij over all ij such that i belongs to s and j belongs to s complement. So, look at those nodes look at those edges rather whose that originate in i those are the left end point is in i and the right end point left end point is in s and right end point is in s complement. Look at the capacity of those look at the capacity of those edges and see all such edges the total capacity of that is called the capacity of the cut. The problem of minimum cut is is find a cut separating s and p of minimum capacity of the millist capacity. So, out of all the cuts that you can potentially create in this in this network what is the cut of least capacity. So, if you want to think in terms of this particular example see for example this particular this cut here this cut here this has capacity what is the capacity of this cut from 10 to from 1 to 4 is 10 plus 1 to 3 is 20 plus 1 to 2 is 30. So, the total the capacity of this particular cut these are the edges that are getting cut the capacity of this cut is 60. Similarly, what is the capacity of this cut from 4 to 5 is 5 from 2 to 5 is 5 again from 3 to 5 is 10 right 5 plus 5 plus 10 that is 20 is the capacity of this. Yes, yes i has to be in s and j has to be in s complement yeah. So, you count the one which is going in which has i comma j where i belongs to s and j belongs to s complement right. So, you say take this cut for example here I can I have to count 2 the edge going from 2 to 3 I have to count the edge going from 2 to 5 and then I have to count the edge going from 4 to 3 because 4 belongs to s and 3 belongs to s complement in this case right that is how I am defining the cut right. So, I mean you should if you want to think of a present day application suppose one is a node where you you know say you have the outbreak of like a coronavirus and you want to isolate a destination node from this these are all the possible ways by which passengers can travel from 1 to from s to t from 1 to 5 you want to inconvenience as few passengers as possible you want to cut off routes. So, that as few as little capacity is reduced as possible you want to inconvenience as few passengers as possible, but yet be able to separate s from t. So, that no more no more flow can form 1 can reach from s can reach t ok. So, that this is this is a pertinent application of the main cut term. So, what link should I cut what is the minimum capacity that I should cut so that s is separated from t right. So, right. So, now, this becomes this is the problem of main cut now you can see this problem is also again trying to find at its heart trying to get to the bottleneck of the network. What should you be cutting well you should be cutting in some sense you can see this is also trying to refer to the what is the bottleneck what is the minimum capacity links that I should cut. So, that then the network becomes disconnected means that you cannot send any flow from s to t right. And what what is amazing is that the main cut problem the main cut problem you can also write as a LP and it becomes exactly this this particular one. So, this here. So, the problem here is the max flow LP if you write out its dual this is its dual and the dual turns out to be the main cut. So, I will leave that as an exercise for you in your homework to verify why this is actually giving you the main cut. But I will give you a few hints here basically the which vertices line s and which line s complement have to get determined by the use. So, if all the vertices that are that are in s will take will have say u i equal to 1 and the ones that are in s complement will have u i let me just quickly write a hint here you can take u i equal to 1 for i belongs to s and 0 for s complement and then w i j will be 1 if i belongs to s and j belongs to s complement and 0 otherwise in which case the objective will like compute exactly the the the the cut the capacity of that cut and then what you need to argue is that is in fact optimal. This is in fact giving you the the the minimum value of the the value of the minimum is the capacity of the minimum cut. So, this is another another application of the max of of linear programming duality and this famous theorem of called the max flow main cut theorem ok.