Ahuja-Orlin: Difference between revisions
Line 49: | Line 49: | ||
## Otherwise: | ## Otherwise: | ||
### While the current arc of <math>v</math> is not void and not [[Basic flow definitions#Valid distance labeling|admissible]], move the current arc one step forward. | ### While the current arc of <math>v</math> is not void and not [[Basic flow definitions#Valid distance labeling|admissible]], move the current arc one step forward. | ||
### If the current arc is void: | ### If the current arc is void: Set <math>d(v):=\tilde{d}+1</math>, where <math>\tilde{d}</math> denotes the minimum value <math>d(w)</math> over all outgoing arcs <math>(v,w)</math> of <math>v</math> in the residual network. | ||
### Otherwise, that is, if the current arc is some arc <math>(v,w)</math>: Push <math>w</math> on <math>S</math>. | ### Otherwise, that is, if the current arc is some arc <math>(v,w)</math>: Push <math>w</math> on <math>S</math>. | ||
Revision as of 11:30, 13 October 2014
General Information
Algorithmic problem: Max-Flow Problems
Type of algorithm: loop
Abstract View
Invariant: After [math]\displaystyle{ i \ge 0 }[/math] iterations:
- The flow [math]\displaystyle{ f }[/math] is a fleasible flow.
- If all upper bounds are integral, [math]\displaystyle{ f }[/math] is integral as well.
- There is a valid distance labeling [math]\displaystyle{ d }[/math] with respect to [math]\displaystyle{ f }[/math].
- Each node [math]\displaystyle{ v\in V\setminus\{t\} }[/math] has a current arc, which is either void or one of the outgoing arcs of [math]\displaystyle{ v }[/math].
- Stack [math]\displaystyle{ S }[/math] contains a current flow-augmenting path with respect to [math]\displaystyle{ f }[/math]. This path starts with [math]\displaystyle{ s }[/math] and ends at an arbitrary node of [math]\displaystyle{ G }[/math]. Each arc on this path is the current arc of its tail node.
Variant: Exactly one of the following actions will take place in the current iteration:
- An arc is appended to the current path.
- At least one arc is saturated.
- The distance label of some node is increased.
Break condition: [math]\displaystyle{ d(s)\geq n }[/math].
Induction basis
Abstract view:
- We start with some feasible flow, for example, the zero flow.
- For each [math]\displaystyle{ v\in V }[/math], [math]\displaystyle{ d(v) }[/math] is initialized to be the smallest number of arcs from [math]\displaystyle{ v }[/math] to [math]\displaystyle{ t }[/math].
- Stack [math]\displaystyle{ S }[/math] is initialized so as to contain [math]\displaystyle{ s }[/math] and no other node.
- The current arc of each node [math]\displaystyle{ v\in V }[/math] is reset to be the very first outgoing arc of [math]\displaystyle{ v }[/math].
Implementation:
- For all [math]\displaystyle{ a \in A }[/math], set [math]\displaystyle{ f(a):=0. }[/math]
- Run a BFS on the transpose of [math]\displaystyle{ G }[/math] with start node [math]\displaystyle{ t }[/math] and unit arc lengths; the resulting distances are the [math]\displaystyle{ d }[/math]-labels.
- Create [math]\displaystyle{ S }[/math] and push [math]\displaystyle{ s }[/math] onto [math]\displaystyle{ S }[/math].
- Reset the current arcs.
Proof: Obvious.
Induction step
Abstract view:
- Let [math]\displaystyle{ v }[/math] be the top element of [math]\displaystyle{ S }[/math], that is, the endnode of the corresponding path.
- If [math]\displaystyle{ v=t }[/math]:
- Augment the current flow along the path correspoding to [math]\displaystyle{ S }[/math].
- Remove all nodes but [math]\displaystyle{ s }[/math] from [math]\displaystyle{ S }[/math].
- Otherwise:
- While the current arc of [math]\displaystyle{ v }[/math] is not void and not admissible, move the current arc one step forward.
- If the current arc is void: Set [math]\displaystyle{ d(v):=\tilde{d}+1 }[/math], where [math]\displaystyle{ \tilde{d} }[/math] denotes the minimum value [math]\displaystyle{ d(w) }[/math] over all outgoing arcs [math]\displaystyle{ (v,w) }[/math] of [math]\displaystyle{ v }[/math] in the residual network.
- Otherwise, that is, if the current arc is some arc [math]\displaystyle{ (v,w) }[/math]: Push [math]\displaystyle{ w }[/math] on [math]\displaystyle{ S }[/math].
Proof: First, we have to show that validity of the distance labeling is maintained.
Always valid
Complexity
Remark
This algorithm may be seen as a "lazy" variant on Edmonds-Karp. In fact, the most expensive step there is the computation of a flow-augmenting [math]\displaystyle{ (s,t) }[/math]-path. This task amounts to computing the true distance from every node to [math]\displaystyle{ t }[/math]. A valid distance labeling may be seen as "lazily evaluated" true distances.