Max-Flow Problems: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(31 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
== | == Basic definitions == | ||
# [[Basic graph definitions]] | |||
# | # [[Basic flow definitions]] | ||
# | |||
== Standard version == | == Standard version == | ||
Line 13: | Line 11: | ||
# A nonnegative '''upper bound (a.k.a. capacity)''' <math>u(a)</math> for each arc <math>a\in A</math>. | # A nonnegative '''upper bound (a.k.a. capacity)''' <math>u(a)</math> for each arc <math>a\in A</math>. | ||
'''Output:''' | |||
A [[Basic flow definitions#Feasible flow|feasible <math>(s,t)</math>-flow]] that has maximum [[Basic flow definitions#Flow value|flow value]] among all feasible <math>(s,t)</math>-flows. | |||
== Known algorithms == | |||
# | # [[Ford-Fulkerson]] | ||
# | # [[Edmonds-Karp]] | ||
# | # [[Ahuja-Orlin]] | ||
# | # [[Dinic]] | ||
# | # [[Preflow-push]] | ||
# | # [[FIFO preflow-push]] | ||
# [[Preflow-push with excess scaling]] | |||
== Generalizations == | == Generalizations == | ||
# For each arc <math>a\in A</math>, there is a '''lower bound''' <math>\ell(a)</math>, and <math>f(a)\geq\ell(a)</math> is additionally required. The lower bounds need not be nonnegative, so the flow values need not be nonnegative, either. This version is often called '''maximum flow with edge demands'''. It may be reduced to solving two instances of the standard version as follows: | # For each arc <math>a\in A</math>, there is a '''lower bound''' <math>\ell(a)</math>, and <math>f(a)\geq\ell(a)</math> is additionally required. The lower bounds need not be nonnegative, so the flow values need not be nonnegative, either. This version is often called '''maximum flow with edge demands'''. It may be reduced to solving two instances of the standard version as follows: | ||
## First, we construct a new graph <math>G'=(V',A')</math> as follows: We add a super-source <math>s'</math> and a super-target <math>t'</math> to <math>V</math>. Next, for every node <math>v\in V</math>, we add an arc <math>(s,v)</math> and an arc <math>(v,t)</math> to <math>A</math>. Finally we add an arc <math>(t,s)</math> to <math>A</math>, if not in <math>A</math> yet. | ## First, we construct a new graph <math>G'=(V',A')</math> as follows: We add a super-source <math>s'</math> and a super-target <math>t'</math> to <math>V</math>. Next, for every node <math>v\in V</math>, we add an arc <math>(s',v)</math> and an arc <math>(v,t')</math> to <math>A</math>. Finally we add an arc <math>(t,s)</math> to <math>A</math>, if not in <math>A</math> yet. | ||
## For all arcs <math>a\in A</math>, we set <math>\ell'(a):=0</math>. For each node <math>v\in V</math>, we set | ## For all arcs <math>a\in A</math>, we set <math>\ell'(a):=0</math>. For each node <math>v\in V</math>, we set | ||
##:<math>u'(s,v):=\sum_{(w,v)\in A}\ell(w,v)</math> and <math>u'(v,t):=\sum_{(v,w)\in A} \ell(v,w)</math>. | ##:<math>u'(s',v):=\max\{0,\sum_{(w,v)\in A}\ell(w,v)\}</math> and <math>u'(v,t'):=\max\{0,\sum_{(v,w)\in A} \ell(v,w)\}</math>. | ||
##:For all arcs <math>a\in A</math>, we set <math>u'(a):=u(a)-\ell(a)</math>. Finally, we set <math>u'(t,s):=+\infty</math>. | ##:For all arcs <math>a\in A</math>, we set <math>u'(a):=u(a)-\ell(a)</math>. Finally, we set <math>u'(t,s):=+\infty</math>. | ||
## | ## If all additional arcs <math>(s',\cdot)</math> and <math>(\cdot,t')</math> are [[Basic flow definitions#Flow-augmenting paths and saturated arcs|saturated]] by some feasible (and obviously maximum) <math>(s',t')</math>-flow <math>f</math>, the values <math>f(a)+\ell(a)</math> on all original arcs of <math>G</math> obviously form a feasible <math>(s,t)</math>-flow in <math>G</math> with respect to <math>\ell</math> and <math>u</math>. On the other hand, if there is a feasible <math>(s,t)</math>-flow <math>f</math> in <math>G</math> with respect to <math>\ell</math> and <math>u</math>, the values <math>f(a)-\ell(a)</math> on all original arcs in <math>G</math> along with saturating flow values on all additional arcs form a feasible (and obviously maximum) <math>(s',t')</math>-flow. | ||
## | ## Therefore, we may safely terminate the whole procedure if the additional arcs are '''not''' saturated by a maximum <math>(s',t')</math>-flow. Otherwise, we may construct an instance <math>(G'=(V,A'),s,t,u')</math> of the standard version as follows: for each original arc <math>a=(v,w)\in A</math> insert an opposite arc <math>a'=(w,v)</math> and set <math>u'(a):=u(a)-f(a)\geq 0</math> and <math>u'(a'):=f(a)-\ell(a)\geq 0</math> (cf. [[Basic flow definitions#Residual network|residual network]]).[[File:Maxflowmultiplesource.png|350px|thumb|right|Max-Flow Problem with several sources and targets]] | ||
# More than one source and more than one target can be reduced to the standard version by adding a super-source node <math>s</math>, a super-target node <math>t</math>, an arc <math>(s,v)</math> with "infinite" capacity for each source <math>v</math>, and an arc <math>(v,t)</math> with "infinite" capacity for each target <math>v</math>. | # More than one source and more than one target can be reduced to the standard version by adding a super-source node <math>s</math>, a super-target node <math>t</math>, an arc <math>(s,v)</math> with "infinite" capacity for each source <math>v</math>, and an arc <math>(v,t)</math> with "infinite" capacity for each target <math>v</math> (for example, the sum of the upper bounds of all arcs is sufficiently large to serve as "infinity"). | ||
# Usually, the term ''generalized flow''' is reserved for the specific generalization in which for each node <math>v\in V\setminus\{ | # Usually, the term '''generalized flow''' is reserved for the specific generalization in which for each node <math>v\in V\setminus\{s,t\}</math>, the ratio of the total sum of all incoming flow and the total sum of all outgoing flow is given (in the standard version, this ratio is 1 due to the flow conservation condition). | ||
# The max-flow problem asks for an optimal steady-state. However, in many applications, a certain amount of flow is to be | # The max-flow problem asks for an optimal steady-state flow. However, in many applications, a certain amount of flow is to be sent as soon as possible from the source to the target. It is easy to see that, if the amount of flow is sufficiently large, then an optimal solution is constant most of the time, and the maximum steady-state flow is this constant flow. |
Latest revision as of 08:58, 31 March 2018
Basic definitions
Standard version
Input:
- A directed graph [math]\displaystyle{ G=(V,A) }[/math].
- A source node [math]\displaystyle{ s\in V }[/math] and a target (a.k.a. sink) node [math]\displaystyle{ t\in V }[/math].
- A nonnegative upper bound (a.k.a. capacity) [math]\displaystyle{ u(a) }[/math] for each arc [math]\displaystyle{ a\in A }[/math].
Output: A feasible [math]\displaystyle{ (s,t) }[/math]-flow that has maximum flow value among all feasible [math]\displaystyle{ (s,t) }[/math]-flows.
Known algorithms
- Ford-Fulkerson
- Edmonds-Karp
- Ahuja-Orlin
- Dinic
- Preflow-push
- FIFO preflow-push
- Preflow-push with excess scaling
Generalizations
- For each arc [math]\displaystyle{ a\in A }[/math], there is a lower bound [math]\displaystyle{ \ell(a) }[/math], and [math]\displaystyle{ f(a)\geq\ell(a) }[/math] is additionally required. The lower bounds need not be nonnegative, so the flow values need not be nonnegative, either. This version is often called maximum flow with edge demands. It may be reduced to solving two instances of the standard version as follows:
- First, we construct a new graph [math]\displaystyle{ G'=(V',A') }[/math] as follows: We add a super-source [math]\displaystyle{ s' }[/math] and a super-target [math]\displaystyle{ t' }[/math] to [math]\displaystyle{ V }[/math]. Next, for every node [math]\displaystyle{ v\in V }[/math], we add an arc [math]\displaystyle{ (s',v) }[/math] and an arc [math]\displaystyle{ (v,t') }[/math] to [math]\displaystyle{ A }[/math]. Finally we add an arc [math]\displaystyle{ (t,s) }[/math] to [math]\displaystyle{ A }[/math], if not in [math]\displaystyle{ A }[/math] yet.
- For all arcs [math]\displaystyle{ a\in A }[/math], we set [math]\displaystyle{ \ell'(a):=0 }[/math]. For each node [math]\displaystyle{ v\in V }[/math], we set
- [math]\displaystyle{ u'(s',v):=\max\{0,\sum_{(w,v)\in A}\ell(w,v)\} }[/math] and [math]\displaystyle{ u'(v,t'):=\max\{0,\sum_{(v,w)\in A} \ell(v,w)\} }[/math].
- For all arcs [math]\displaystyle{ a\in A }[/math], we set [math]\displaystyle{ u'(a):=u(a)-\ell(a) }[/math]. Finally, we set [math]\displaystyle{ u'(t,s):=+\infty }[/math].
- If all additional arcs [math]\displaystyle{ (s',\cdot) }[/math] and [math]\displaystyle{ (\cdot,t') }[/math] are saturated by some feasible (and obviously maximum) [math]\displaystyle{ (s',t') }[/math]-flow [math]\displaystyle{ f }[/math], the values [math]\displaystyle{ f(a)+\ell(a) }[/math] on all original arcs of [math]\displaystyle{ G }[/math] obviously form a feasible [math]\displaystyle{ (s,t) }[/math]-flow in [math]\displaystyle{ G }[/math] with respect to [math]\displaystyle{ \ell }[/math] and [math]\displaystyle{ u }[/math]. On the other hand, if there is a feasible [math]\displaystyle{ (s,t) }[/math]-flow [math]\displaystyle{ f }[/math] in [math]\displaystyle{ G }[/math] with respect to [math]\displaystyle{ \ell }[/math] and [math]\displaystyle{ u }[/math], the values [math]\displaystyle{ f(a)-\ell(a) }[/math] on all original arcs in [math]\displaystyle{ G }[/math] along with saturating flow values on all additional arcs form a feasible (and obviously maximum) [math]\displaystyle{ (s',t') }[/math]-flow.
- Therefore, we may safely terminate the whole procedure if the additional arcs are not saturated by a maximum [math]\displaystyle{ (s',t') }[/math]-flow. Otherwise, we may construct an instance [math]\displaystyle{ (G'=(V,A'),s,t,u') }[/math] of the standard version as follows: for each original arc [math]\displaystyle{ a=(v,w)\in A }[/math] insert an opposite arc [math]\displaystyle{ a'=(w,v) }[/math] and set [math]\displaystyle{ u'(a):=u(a)-f(a)\geq 0 }[/math] and [math]\displaystyle{ u'(a'):=f(a)-\ell(a)\geq 0 }[/math] (cf. residual network).
- More than one source and more than one target can be reduced to the standard version by adding a super-source node [math]\displaystyle{ s }[/math], a super-target node [math]\displaystyle{ t }[/math], an arc [math]\displaystyle{ (s,v) }[/math] with "infinite" capacity for each source [math]\displaystyle{ v }[/math], and an arc [math]\displaystyle{ (v,t) }[/math] with "infinite" capacity for each target [math]\displaystyle{ v }[/math] (for example, the sum of the upper bounds of all arcs is sufficiently large to serve as "infinity").
- Usually, the term generalized flow is reserved for the specific generalization in which for each node [math]\displaystyle{ v\in V\setminus\{s,t\} }[/math], the ratio of the total sum of all incoming flow and the total sum of all outgoing flow is given (in the standard version, this ratio is 1 due to the flow conservation condition).
- The max-flow problem asks for an optimal steady-state flow. However, in many applications, a certain amount of flow is to be sent as soon as possible from the source to the target. It is easy to see that, if the amount of flow is sufficiently large, then an optimal solution is constant most of the time, and the maximum steady-state flow is this constant flow.