Editing Maximum flow

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 77: Line 77:
 
For any weighted s-t graph <math>(V, E, s, t, w)</math>, there is a corresponding flow network <math>(V, s, t, c)</math> with the same structure. Here, <math>c(u, v) = w((u, v))</math> if <math>(u, v) \in E</math>, otherwise <math>c(u, v) = 0</math>. In other words, the capacity between two vertices in the flow network is just the weight of the edge between them in the weighted s-t graph, or zero if there is no such edge.
 
For any weighted s-t graph <math>(V, E, s, t, w)</math>, there is a corresponding flow network <math>(V, s, t, c)</math> with the same structure. Here, <math>c(u, v) = w((u, v))</math> if <math>(u, v) \in E</math>, otherwise <math>c(u, v) = 0</math>. In other words, the capacity between two vertices in the flow network is just the weight of the edge between them in the weighted s-t graph, or zero if there is no such edge.
  
A famous result known as the [[max-flow min-cut theorem]] demonstrates the equivalence of the maximum flow and minimum s-t cut problems. The theorem tells us that the value of a max flow in a flow network equals the total weight of a min cut in the corresponding weighted s-t graph. Because of this, there is no need to devise separate algorithms for the max flow and minimum s-t cut problems. Constructing a min cut from a max flow is straightforward and is based on the proof of the theorem. On the other hand, a max flow cannot be straightforwardly constructed from a min cut.
+
A famous result known as the ''max-flow min-cut theorem'' demonstrates the equivalence of the maximum flow and minimum s-t cut problems. The max-flow min-cut theorem follows from strong [[duality]] in linear programming, however we shall state and prove it directly below.
 +
 
 +
'''Lemma 1''': Let <math>f</math> be a flow in a flow network <math>(V, s, t, c)</math>. Suppose we have a set <math>S \subset V</math> such that <math>s \in S</math> and <math>t \notin S</math>. Then the value of the flow <math>\sum_{v \in S} f(s, v)</math> equals the total flow leaving <math>S</math>, <math>\sum_{u \in S} \sum_{v \notin S} f(u, v)</math>.
 +
 
 +
'''Proof''':
 +
:<math>\sum_{u \in S} \sum_{v \notin S} f(u, v)</math>
 +
:<math>= \sum_{u \in S} \sum_{v \in V} f(u, v) - \sum_{u \in S} \sum_{v \in S} f(u, v)</math>
 +
:<math>= \sum_{u \in S} \sum_{v \in V} f(u, v)</math> ''(by skew symmetry)''
 +
:<math>= \sum_{u \in S-\{s\}} \sum_{v \in V} f(u, v) + \sum_{v \in V} f(s, v)</math>
 +
:<math>= \sum_{v \in V} f(s, v)</math> ''(by flow conservation)'' <math>_\blacksquare</math>
 +
 
 +
'''Lemma 2''': Let <math>f</math> be a flow in a flow network <math>(V, s, t, c)</math>. Let <math>C</math> be an s-t cut in the corresponding weighted s-t graph <math>(V, E, s, t, w)</math>. Then the value of <math>f</math>, <math>\sum_{v \in V} f(s, v)</math>, is less than or equal to the total weight of <math>C</math>, <math>\sum_{e \in C} w(e)</math>.
 +
 
 +
'''Proof''': Since <math>C</math> is an s-t cut, in the weighted s-t graph <math>(V, E \setminus C, s, t, w)</math>, there is no path from <math>s</math> to <math>t</math>. We can therefore consider the set <math>S</math> of all vertices reachable from <math>s</math> in this graph. Note that <math>t \notin S</math>. Applying Lemma 1, we find that <math>\sum_{v \in S} f(s, v) = \sum_{u \in S} \sum_{v \notin S} f(u, v) \leq \sum_{u \in S} \sum_{v \notin S} c(u, v) = \sum_{e \in C'} w(e)</math>. <math>_\blacksquare</math>
 +
 
 +
The intuition behind the Lemmata and their proofs is that, if we cut the graph, then all the flow coming out of the source has to get from nodes in <math>S</math> to nodes in <math>V\setminus S</math> at some point, and it can only do so by flowing out through edges between <math>S</math> and <math>V\setminus S</math>. The total amount of flow cannot therefore exceed the total capacity of such edges, which is the same as the total weight of the cut.
 +
 
 +
We are now ready to state and prove the main result of this section.
 +
 
 +
'''Theorem (Max-flow min-cut theorem)''': Let <math>f</math> be a maximum flow in a flow network <math>(V, s, t, c)</math>. Consider the set <math>S \subset V</math> consisting of vertices reachable from <math>s</math> in the residual network corresponding to <math>f</math>. A minimum s-t cut of the corresponding weighted s-t graph <math>(V, E, s, t, w)</math> is given by <math>C = \{e = (u, v) \mid e \in E, u \in S, v \notin S \}</math>. Furthermore, the value of the max flow <math>\sum_{v \in V} f(s, v)</math> equals the value of the min cut <math>\sum_{e \in C} w(e)</math>.
 +
 
 +
'''Proof''': It suffices to show that <math>\sum_{v \in V} f(s, v) = \sum_{e \in C} w(e)</math>. The fact that the cut <math>C</math> is minimal then follows immediately from Lemma 2.
 +
 
 +
Since the flow <math>f</math> is maximal, there is no [[augmenting path]] in the residual network <math>(V, s, t, r)</math>. Therefore, <math>t \notin S</math>. Now, <math>r(u, v) = 0</math> for all <math>u \in S</math> and <math>v \notin S</math>, by definition of <math>S</math>. Therefore, <math>c(u, v) = f(u, v)</math> for all such edges. By Lemma 1, <math>\sum_{v \in V} f(s, v) = \sum_{u \in S} \sum_{v \notin S} f(u, v) = \sum_{u \in S} \sum_{v \notin S} c(u, v) = \sum_{e \in C} w(e)</math>. <math>_\blacksquare</math>
 +
 
 +
In other words, we can solve the minimum s-t cut problem simply by converting all the edge weights to capacities and then finding a maximum flow in the resulting flow network. If we only want the weight of the min cut, we can simply find the value of the max flow, and be done with it. If we want to find the cut explicitly, then it is still straightforward to do so using the residual graph corresponding to the max flow. The "s part" of the s-t cut will consist of vertices reachable from <math>s</math> in the residual graph, with the remainder the "t part". The edges we want to cut are the ones from the "s part" to the "t part".
  
 
==Variations==
 
==Variations==

Please note that all contributions to PEGWiki are considered to be released under the Attribution 3.0 Unported (see PEGWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)