Three indians' algorithm: Difference between revisions

From Algowiki
Jump to navigation Jump to search
Line 39: Line 39:


'''Proof:'''
'''Proof:'''
Consider step 4 (step 5 is analogous). The specific choice of <matH>v_0</math> ensures <math>F(v)\leq T(v)</math> for each node <math>v\in V</math> at any time. Therefore, all flow arrived at <math>v</math> can be moved forward along the arcs leaving <math>v</math>. In other words, when <math>v</math> is finished, it is <math>F(v)=0</math>. In summary, the result is a feasible <math>(s,t)</math>-flow again, and the flow valiue has increased by the initial value of <math>T(v)</math>. In particular, it is <math>T(v)=0</math> at the end, so at least <math>v_0</math> will be removed in this iteration.
Consider step 4 (step 5 is analogous). The specific choice of <matH>v_0</math> ensures <math>F(v)\leq T(v)</math> for each node <math>v\in V</math> at any time. Therefore, all flow arrived at <math>v</math> can be moved forward along the arcs leaving <math>v</math>. In other words, when <math>v</math> is finished, it is <math>F(v)=0</math>. In summary, the result is a feasible <math>(s,t)</math>-flow again, and the flow valiue has increased by the initial value of <math>T(v_0)</math>. In particular, it is <math>T(v)=0</math> at the end, so at least <math>v_0</math> will be removed in this iteration.


== Remarks ==
== Remarks ==

Revision as of 03:24, 20 October 2014

General information

Algorithmic problem: Blocking flow.

Type of algorithm: loop.

Abstract view

Invariant: The current flow is feasible.

Variant: The number of nodes strictly decreases.

Induction basis

Abstract view: The flow is initialized to be feasible, for example, the zero flow.

Proof: Obvious.

Induction step

Abstract view: Choose the node [math]\displaystyle{ v_0 }[/math] through which the minimum amount of flow may go, and propagate this amount from [math]\displaystyle{ v_0 }[/math] forward to [math]\displaystyle{ t }[/math] and backward to [math]\displaystyle{ s }[/math].

Implementation:

  1. For each node [math]\displaystyle{ v\in V\setminus\{s,t\} }[/math], let [math]\displaystyle{ T(v):=\min\left\{\sum_{w:(v,w)\in A}u(v,w),\sum_{w:(w,v)\in A}u(w,v)\right\} }[/math] (the throughput of node [math]\displaystyle{ v }[/math]).
  2. Let [math]\displaystyle{ v_0\in V\setminus\{s,t\} }[/math] be a node with minimum throughput [math]\displaystyle{ T(v_0) }[/math].
  3. Set [math]\displaystyle{ F(v_0):=T(v_0) }[/math] and [math]\displaystyle{ T(v):=0 }[/math] for all nodes [math]\displaystyle{ v\in V\setminus\{s,t,v_0\} }[/math].
  4. Run a modified BFS from [math]\displaystyle{ v_0 }[/math], where for every processed arc [math]\displaystyle{ (v,w)\in A }[/math]:
    1. Let [math]\displaystyle{ \Delta:=\min\{u(v,w),F(v)\} }[/math].
    2. Increase the flow over [math]\displaystyle{ (v,w) }[/math] by [math]\displaystyle{ \Delta }[/math].
    3. Increase [math]\displaystyle{ F(w) }[/math] by [math]\displaystyle{ \Delta }[/math].
    4. Decrease [math]\displaystyle{ F(v) }[/math] and [math]\displaystyle{ T(v) }[/math] by [math]\displaystyle{ \Delta }[/math].
    5. If [math]\displaystyle{ T(v)=0 }[/math], remove [math]\displaystyle{ v }[/math] and all of its incident arcs from [math]\displaystyle{ G }[/math].
  5. Run the same modified BFS from [math]\displaystyle{ v_0 }[/math] on the transpose of [math]\displaystyle{ G }[/math] (all removals apply to [math]\displaystyle{ G }[/math]).

Proof: Consider step 4 (step 5 is analogous). The specific choice of [math]\displaystyle{ v_0 }[/math] ensures [math]\displaystyle{ F(v)\leq T(v) }[/math] for each node [math]\displaystyle{ v\in V }[/math] at any time. Therefore, all flow arrived at [math]\displaystyle{ v }[/math] can be moved forward along the arcs leaving [math]\displaystyle{ v }[/math]. In other words, when [math]\displaystyle{ v }[/math] is finished, it is [math]\displaystyle{ F(v)=0 }[/math]. In summary, the result is a feasible [math]\displaystyle{ (s,t) }[/math]-flow again, and the flow valiue has increased by the initial value of [math]\displaystyle{ T(v_0) }[/math]. In particular, it is [math]\displaystyle{ T(v)=0 }[/math] at the end, so at least [math]\displaystyle{ v_0 }[/math] will be removed in this iteration.

Remarks

  1. The algorithm is named after three indian researchers, V. M. Malhotra, M. Pramodh Kumar, and S. N. Mahashwari.
  2. Of course, the nodes and arcs need not really be removed from the graph. However, "removed" nodes and arcs must be hidden from the algorithm to ensure the asymptotic complexity; a Boolean lable "is removed" does not suffice for that.