Template:Short description In computer science and optimization theory, the max-flow min-cut theorem states that in a flow network, the maximum amount of flow passing from the source to the sink is equal to the total weight of the edges in a minimum cut, i.e., the smallest total weight of the edges which if removed would disconnect the source from the sink.

For example, imagine a network of pipes carrying water from a reservoir (the source) to a city (the sink). Each pipe has a capacity representing the maximum amount of water that can flow through it per unit of time. The max-flow min-cut theorem tells us that the maximum amount of water that can reach the city is limited by the smallest total capacity of any set of pipes that, if cut, would completely isolate the reservoir from the city. This smallest total capacity is the min-cut. So, if there's a bottleneck in the pipe network, represented by a small min-cut, that bottleneck will determine the overall maximum flow of water to the city.

This is a special case of the duality theorem for linear programs and can be used to derive Menger's theorem and the Kőnig–Egerváry theorem.<ref>Template:Cite journal</ref>

Definitions and statementEdit

The theorem equates two quantities: the maximum flow through a network, and the minimum capacity of a cut of the network. To state the theorem, each of these notions must first be defined.

NetworkEdit

A network consists of

FlowsEdit

A flow through a network is a mapping <math>f:E\to\R^+</math> denoted by <math>f_{uv}</math> or <math>f(u, v)</math>, subject to the following two constraints:

  1. Capacity Constraint: For every edge <math>(u, v) \in E</math>, <math>f_{uv} \le c_{uv}.</math>
  2. Conservation of Flows: For each vertex <math>v</math> apart from <math>s</math> and <math>t</math> (i.e. the source and sink, respectively), the following equality holds:
    <math>\sum\nolimits_{\{ u : (u,v)\in E\}} f_{uv} = \sum\nolimits_{\{w : (v,w)\in E\}} f_{vw}.</math>

A flow can be visualized as a physical flow of a fluid through the network, following the direction of each edge. The capacity constraint then says that the volume flowing through each edge per unit time is less than or equal to the maximum capacity of the edge, and the conservation constraint says that the amount that flows into each vertex equals the amount flowing out of each vertex, apart from the source and sink vertices.

The value of a flow is defined by

<math>|f| = \sum\nolimits_{\{v : (s,v)\in E\}} f_{sv}=\sum\nolimits_{\{v : (v,t)\in E\}} f_{vt},</math>

where as above <math>s</math> is the source and <math>t</math> is the sink of the network. In the fluid analogy, it represents the amount of fluid entering the network at the source. Because of the conservation axiom for flows, this is the same as the amount of flow leaving the network at the sink.

The maximum flow problem asks for the largest flow on a given network.

Maximum Flow Problem. Maximize <math>|f|</math>, that is, to route as much flow as possible from <math>s</math> to <math>t</math>.

CutsEdit

The other half of the max-flow min-cut theorem refers to a different aspect of a network: the collection of cuts. An s-t cut Template:Math is a partition of Template:Mvar such that Template:Math and Template:Math. That is, an s-t cut is a division of the vertices of the network into two parts, with the source in one part and the sink in the other. The cut-set <math>X_C</math> of a cut Template:Mvar is the set of edges that connect the source part of the cut to the sink part:

<math>X_C := \{ (u, v) \in E \ : \ u \in S, v \in T \} = (S\times T) \cap E.</math>

Thus, if all the edges in the cut-set of Template:Mvar are removed, then no positive flow is possible, because there is no path in the resulting graph from the source to the sink.

The capacity of an s-t cut is the sum of the capacities of the edges in its cut-set,

<math>c(S,T) = \sum\nolimits_{(u,v) \in X_C} c_{uv} = \sum\nolimits_{(i,j) \in E } c_{ij}d_{ij},</math>

where <math>d_{ij} = 1</math> if <math>i \in S</math> and <math>j \in T</math>, <math>0</math> otherwise.

There are typically many cuts in a graph, but cuts with smaller weights are often more difficult to find.

Minimum s-t Cut Problem. Minimize Template:Math, that is, determine Template:Mvar and Template:Mvar such that the capacity of the s-t cut is minimal.

Main theoremEdit

In the above situation, one can prove that the value of any flow through a network is less than or equal to the capacity of any s-t cut, and that furthermore a flow with maximal value and a cut with minimal capacity exist. The main theorem links the maximum flow value with the minimum cut capacity of the network.

Max-flow min-cut theorem. The maximum value of an s-t flow is equal to the minimum capacity over all s-t cuts.

ExampleEdit

File:Max flow.svg
A maximal flow in a network. Each edge is labeled with f/c, where f is the flow over the edge and c is the edge's capacity. The flow value is 5. There are several minimal s-t cuts with capacity 5; one is S={s,p} and T={o, q, r, t}.

The figure on the right shows a flow in a network. The numerical annotation on each arrow, in the form f/c, indicates the flow (f) and the capacity (c) of the arrow. The flows emanating from the source total five (2+3=5), as do the flows into the sink (2+3=5), establishing that the flow's value is 5.

One s-t cut with value 5 is given by S={s,p} and T={o, q, r, t}. The capacities of the edges that cross this cut are 3 and 2, giving a cut capacity of 3+2=5. (The arrow from o to p is not considered, as it points from T back to S.)

The value of the flow is equal to the capacity of the cut, showing that the flow is a maximal flow and the cut is a minimal cut.

Note that the flow through each of the two arrows that connect S to T is at full capacity; this is always the case: a minimal cut represents a 'bottleneck' of the system.

Linear program formulationEdit

The max-flow problem and min-cut problem can be formulated as two primal-dual linear programs.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Max-flow (Primal)

Min-cut (Dual)

variables

<math>f_{uv}</math> <math>\forall (u,v)\in E</math> [two variables per edge, one in each direction]

<math>d_{uv}</math> <math>\forall (u,v)\in E</math> [a variable per edge]

<math>z_{v}</math> <math>\forall v\in V\setminus \{s,t\}</math> [a variable per non-terminal node]

objective

maximize <math>\sum\nolimits_{v: (s,v)\in E} f_{sv}</math>

[max total flow from source]

minimize <math>\sum\nolimits_{(u,v) \in E } c_{uv}d_{uv}</math>

[min total capacity of edges in cut]

constraints

subject to

<math>\begin{align}

f_{uv} & \leq c_{uv} && \forall (u, v) \in E \\ \sum_{u} f_{uv} - \sum_{w} f_{vw} & = 0 && v \in V\setminus \{s,t\} \end{align}</math>

[a constraint per edge and a constraint per non-terminal node]

subject to

<math>\begin{align}

d_{uv} - z_u + z_v & \geq 0 && \forall (u, v) \in E, u\neq s, v\neq t \\ d_{sv} + z_v & \geq 1 && \forall (s, v) \in E, v\neq t \\ d_{ut} - z_u & \geq 0 && \forall (u, t) \in E,u\neq s \\ d_{st} & \geq 1 && \text{if } (s, t) \in E \end{align}</math>

[a constraint per edge]

sign constraints <math>\begin{align}

f_{uv} & \geq 0 && \forall (u, v) \in E\\ \end{align}</math>

<math>\begin{align}

d_{uv} & \geq 0 && \forall (u, v) \in E \\ z_v & \in \R && \forall v \in V\setminus \{s,t\} \end{align}</math>

The max-flow LP is straightforward. The dual LP is obtained using the algorithm described in dual linear program: the variables and sign constraints of the dual correspond to the constraints of the primal, and the constraints of the dual correspond to the variables and sign constraints of the primal. The resulting LP requires some explanation. The interpretation of the variables in the min-cut LP is:

<math>d_{uv} = \begin{cases} 1, & \text{if }u \in S \text{ and } v \in T \text{ (the edge } uv \text{ is in the cut) }

\\ 0, & \text{otherwise} \end{cases}</math>

<math>z_{v} = \begin{cases} 1, & \text{if } v \in S \\ 0, & \text{otherwise} \end{cases}</math>

The minimization objective sums the capacity over all the edges that are contained in the cut.

The constraints guarantee that the variables indeed represent a legal cut:<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

  • The constraints <math>d_{uv} - z_u + z_v \geq 0</math> (equivalent to <math>d_{uv} \geq z_u - z_v </math>) guarantee that, for non-terminal nodes u,v, if u is in S and v is in T, then the edge (u,v) is counted in the cut (<math>d_{uv} \geq 1 </math>).
  • The constraints <math>d_{sv} + z_v \geq 1</math> (equivalent to <math>d_{sv} \geq 1 - z_v </math>) guarantee that, if v is in T, then the edge (s,v) is counted in the cut (since s is by definition in S).
  • The constraints <math>d_{ut} - z_u \geq 0</math> (equivalent to <math>d_{ut} \geq z_u </math>) guarantee that, if u is in S, then the edge (u,t) is counted in the cut (since t is by definition in T).

Note that, since this is a minimization problem, we do not have to guarantee that an edge is not in the cut - we only have to guarantee that each edge that should be in the cut, is summed in the objective function.

The equality in the max-flow min-cut theorem follows from the strong duality theorem in linear programming, which states that if the primal program has an optimal solution, x*, then the dual program also has an optimal solution, y*, such that the optimal values formed by the two solutions are equal.

ApplicationEdit

Cederbaum's maximum flow theoremEdit

Template:See also The maximum flow problem can be formulated as the maximization of the electrical current through a network composed of nonlinear resistive elements.<ref>Template:Cite journal</ref> In this formulation, the limit of the current Template:Math between the input terminals of the electrical network as the input voltage Template:Math approaches <math>\infty</math>, is equal to the weight of the minimum-weight cut set.

<math>\lim_{V_{\text{in}} \to \infty} (I_{in})= \min_{X_C}\sum_{(u,v) \in X_C}c_{uv} </math>

Generalized max-flow min-cut theoremEdit

In addition to edge capacity, consider there is capacity at each vertex, that is, a mapping <math>c:V\to\R^+</math> denoted by Template:Math, such that the flow Template:Math has to satisfy not only the capacity constraint and the conservation of flows, but also the vertex capacity constraint

<math>\forall v \in V \setminus \{s,t\} : \qquad \sum\nolimits_{\{u\in V\mid (u,v)\in E\}} f_{uv} \le c(v).</math>

In other words, the amount of flow passing through a vertex cannot exceed its capacity. Define an s-t cut to be the set of vertices and edges such that for any path from s to t, the path contains a member of the cut. In this case, the capacity of the cut is the sum of the capacity of each edge and vertex in it.

In this new definition, the generalized max-flow min-cut theorem states that the maximum value of an s-t flow is equal to the minimum capacity of an s-t cut in the new sense.

Menger's theoremEdit

Template:See also In the undirected edge-disjoint paths problem, we are given an undirected graph Template:Math and two vertices Template:Mvar and Template:Mvar, and we have to find the maximum number of edge-disjoint s-t paths in Template:Mvar.

Menger's theorem states that the maximum number of edge-disjoint s-t paths in an undirected graph is equal to the minimum number of edges in an s-t cut-set.

Project selection problemEdit

File:Max-flow min-cut project-selection.svg
A network formulation of the project selection problem with the optimal solution

In the project selection problem, there are Template:Mvar projects and Template:Mvar machines. Each project Template:Mvar yields revenue Template:Math and each machine Template:Mvar costs Template:Math to purchase. We want to select a subset of the project, and purchase a subset of the machines, to maximize the total profit (revenue of the selected projects minus cost of the purchased machines). We must obey the following constraint: each project specifies a set of machines which must be purchased if the project is selected. (Each machine, once purchased, can be used by any selected project.)

To solve the problem, let Template:Mvar be the set of projects not selected and Template:Mvar be the set of machines purchased, then the problem can be formulated as,

<math>\max \{g\} = \sum_{i} r(p_i) - \sum_{p_i \in P} r(p_i) - \sum_{q_j \in Q} c(q_j).</math>

Since the first term does not depend on the choice of Template:Mvar and Template:Mvar, this maximization problem can be formulated as a minimization problem instead, that is,

<math>\min \{g'\} = \sum_{p_i \in P} r(p_i) + \sum_{q_j \in Q} c(q_j).</math>

The above minimization problem can then be formulated as a minimum-cut problem by constructing a network, where the source is connected to the projects with capacity Template:Math, and the sink is connected by the machines with capacity Template:Math. An edge Template:Math with infinite capacity is added if project Template:Mvar requires machine Template:Mvar. The s-t cut-set represents the projects and machines in Template:Mvar and Template:Mvar respectively. By the max-flow min-cut theorem, one can solve the problem as a maximum flow problem.

The figure on the right gives a network formulation of the following project selection problem:

Project Template:Math

Machine Template:Math

1 100 200

Project 1 requires machines 1 and 2.

2 200 100

Project 2 requires machine 2.

3 150 50

Project 3 requires machine 3.

The minimum capacity of an s-t cut is 250 and the sum of the revenue of each project is 450; therefore the maximum profit g is 450 − 250 = 200, by selecting projects Template:Math and Template:Math.

The idea here is to 'flow' each project's profits through the 'pipes' of its machines. If we cannot fill the pipe from a machine, the machine's return is less than its cost, and the min cut algorithm will find it cheaper to cut the project's profit edge instead of the machine's cost edge.

Image segmentation problemEdit

Template:See also

File:Image segmentation.jpg
Each black node denotes a pixel.

In the image segmentation problem, there are Template:Mvar pixels. Each pixel Template:Mvar can be assigned a foreground value Template:Mvar or a background value Template:Mvar. There is a penalty of Template:Mvar if pixels Template:Mvar are adjacent and have different assignments. The problem is to assign pixels to foreground or background such that the sum of their values minus the penalties is maximum.

Let Template:Mvar be the set of pixels assigned to foreground and Template:Mvar be the set of points assigned to background, then the problem can be formulated as,

<math>\max \{g\} = \sum_{i \in P} f_i + \sum_{i \in Q} b_i - \sum_{i \in P,j \in Q \lor j \in P,i \in Q } p_{ij}.</math>

This maximization problem can be formulated as a minimization problem instead, that is,

<math>\min \{g'\} = \sum_{i \in P,j \in Q \lor j \in P,i \in Q } p_{ij}.</math>

The above minimization problem can be formulated as a minimum-cut problem by constructing a network where the source (orange node) is connected to all the pixels with capacity Template:Mvar, and the sink (purple node) is connected by all the pixels with capacity Template:Mvar. Two edges (Template:Mvar) and (Template:Mvar) with Template:Mvar capacity are added between two adjacent pixels. The s-t cut-set then represents the pixels assigned to the foreground in Template:Mvar and pixels assigned to background in Template:Mvar.

HistoryEdit

An account of the discovery of the theorem was given by Ford and Fulkerson in 1962:<ref>L. R. Ford Jr. & D. R. Fulkerson (1962) Flows in Networks, page 1, Princeton University Press Template:Mr</ref>

"Determining a maximal steady state flow from one point to another in a network subject to capacity limitations on arcs ... was posed to the authors in the spring of 1955 by T.E. Harris, who, in conjunction with General F. S. Ross (Ret.) had formulated a simplified model of railway traffic flow, and pinpointed this particular problem as the central one suggested by the model. It was not long after this until the main result, Theorem 5.1, which we call the max-flow min-cut theorem, was conjectured and established.<ref>L. R. Ford Jr. and D. R. Fulkerson (1956) "Maximal flow through a network", Canadian Journal of Mathematics 8: 399–404</ref> A number of proofs have since appeared."<ref>P. Elias, A. Feinstein, and C. E. Shannon (1956) "A note on the maximum flow through a network", IRE. Transactions on Information Theory, 2(4): 117–119</ref><ref>George Dantzig and D. R. Fulkerson (1956) "On the Max-Flow MinCut Theorem of Networks", in Linear Inequalities, Ann. Math. Studies, no. 38, Princeton, New Jersey</ref><ref>L. R. Ford & D. R. Fulkerson (1957) "A simple algorithm for finding the maximum network flows and an application to the Hitchcock problem", Canadian Journal of Mathematics 9: 210–18</ref>

ProofEdit

Let Template:Math be a network (directed graph) with Template:Mvar and Template:Mvar being the source and the sink of Template:Mvar respectively.

Consider the flow Template:Math computed for Template:Mvar by Ford–Fulkerson algorithm. In the residual graph Template:Math obtained for Template:Mvar (after the final flow assignment by Ford–Fulkerson algorithm), define two subsets of vertices as follows:

  1. Template:Mvar: the set of vertices reachable from Template:Mvar in Template:Mvar
  2. Template:Mvar: the set of remaining vertices i.e. Template:Mvar

Claim. Template:Math, where the capacity of an s-t cut is defined by

<math>c(S,T) = \sum\nolimits_{(u,v) \in S \times T} c_{uv}</math>.

Now, we know, <math>value(f) = f_{out}(A) - f_{in}(A)</math> for any subset of vertices, Template:Mvar. Therefore, for Template:Math we need:

  • All outgoing edges from the cut must be fully saturated.
  • All incoming edges to the cut must have zero flow.

To prove the above claim we consider two cases:

Both of the above statements prove that the capacity of cut obtained in the above described manner is equal to the flow obtained in the network. Also, the flow was obtained by Ford-Fulkerson algorithm, so it is the max-flow of the network as well.

Also, since any flow in the network is always less than or equal to capacity of every cut possible in a network, the above described cut is also the min-cut which obtains the max-flow.

A corollary from this proof is that the maximum flow through any set of edges in a cut of a graph is equal to the minimum capacity of all previous cuts.

See alsoEdit

ReferencesEdit

Template:Reflist