Max-Flow Problems: Difference between revisions

From Algowiki
Jump to navigation Jump to search
Line 26: Line 26:
## 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 <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>. 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>\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>. 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>.
## It is easy to see that there is a feasible <math>(s,t)</math>-flow in <math>G</math> with respect to <math>\ell</math> and <math>u</math> if, and only if, the maximum flow in <math>G</math> from <math>s'</math> to <math>t'</math> with respect to <math>\ell'<math> and <math>u'</math> yields a flow ov value <math>\sum_{a\in A}\ell(a)</math>.
## It is easy to see that there is a feasible <math>(s,t)</math>-flow in <math>G</math> with respect to <math>\ell</math> and <math>u</math> if, and only if, the maximum flow in <math>G</math> from <math>s'</math> to <math>t'</math> with respect to <math>\ell'</math> and <math>u'</math> yields a flow ov value <math>\sum_{a\in A}\ell(a)</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>.
# 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>.
# Usually, the term ''generalized flow''' is reserved for the specific generalization in which for each node <math>v\in V\setminus\{vs,t\}</math>, the ratio of the total sum of all incoming flow an the total sum of all outgoing flow is given (in the standard version, this ratio is 1 due to the flow conservation condition).
# Usually, the term ''generalized flow''' is reserved for the specific generalization in which for each node <math>v\in V\setminus\{vs,t\}</math>, the ratio of the total sum of all incoming flow an the total sum of all outgoing flow is given (in the standard version, this ratio is 1 due to the flow conservation condition).

Revision as of 11:36, 11 October 2014

Assumptions

For convenience, without loss of generality:

  1. In all variations below, all numbers are integral: real numbers may be approximated by uniformly distant numbers with a negligible loss of precision.
  2. There are no parallel arcs in directed graphs [math]\displaystyle{ G=(V,A) }[/math]: if there are parallel arcs, they may be replaced by one of them, with their upper bounds, lower bounds, and flow values summed up, respectively. In particular, an arc may be identified with the ordered pair [math]\displaystyle{ (v,w) }[/math]consisting of the arc's tail [math]\displaystyle{ v\in V }[/math] and head [math]\displaystyle{ w\in V }[/math].
  3. For each arc [math]\displaystyle{ (v,w)\in A }[/math], there is also a reverse arc [math]\displaystyle{ (w,v)\in A }[/math]: if not, just add one with upper (and lower) bound zero.

Standard version

Input:

  1. A directed graph [math]\displaystyle{ G=(V,A) }[/math].
  2. A source node [math]\displaystyle{ s\in V }[/math] and a target (a.k.a. sink) node [math]\displaystyle{ t\in V }[/math].
  3. A nonnegative upper bound (a.k.a. capacity) [math]\displaystyle{ u(a) }[/math] for each arc [math]\displaystyle{ a\in A }[/math].


Output: A maximum [math]\displaystyle{ (s,t) }[/math]-flow, that is, a nonnegative value [math]\displaystyle{ f(a) }[/math] for each arc [math]\displaystyle{ a\in A }[/math] such that:

  1. The flow is feasible following two conditions are fulfilled:
    1. Capacity constraint: For each arc [math]\displaystyle{ a\in A }[/math], it is [math]\displaystyle{ f(a)\leq u(a) }[/math].
    2. Flow conservation condition: For each node [math]\displaystyle{ v\in V\setminus\{s,t\} }[/math], it is [math]\displaystyle{ \sum_{a=(v,w)\in A}f(a)=\sum_{a=(w,v)\in A}f(a) }[/math].
  2. Among all feasible flows, [math]\displaystyle{ f }[/math] has maximum flow value, which is defined as [math]\displaystyle{ v(f):=\sum_{(s,v)\in A}f(s,v)-\sum_{(v,s)\in A}f(v,s)=\sum_{(v,t)\in A}f(v,t)-\sum_{(t,v)\in A}f(t,v) }[/math].

Generalizations

  1. 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:
    1. 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>(s,v)</math> and an arc [math]\displaystyle{ (v,t)\lt math\gt to \lt math\gt A }[/math]. Finally we add an arc [math]\displaystyle{ (t,s)\lt math\gt to \lt math\gt A }[/math], if not in [math]\displaystyle{ A }[/math] yet.
    2. 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):=\sum_{(w,v)\in A}\ell(w,v) }[/math] and [math]\displaystyle{ u'(v,t):=\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].
    3. It is easy to see that there is 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] if, and only if, the maximum flow in [math]\displaystyle{ G }[/math] from [math]\displaystyle{ s' }[/math] to [math]\displaystyle{ t' }[/math] with respect to [math]\displaystyle{ \ell' }[/math] and [math]\displaystyle{ u' }[/math] yields a flow ov value [math]\displaystyle{ \sum_{a\in A}\ell(a) }[/math].
  2. 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].
  3. Usually, the term generalized flow' is reserved for the specific generalization in which for each node [math]\displaystyle{ v\in V\setminus\{vs,t\} }[/math], the ratio of the total sum of all incoming flow an the total sum of all outgoing flow is given (in the standard version, this ratio is 1 due to the flow conservation condition).