# Preflow-push

Jump to: navigation, search

## Abstract view

Also known as: push-relabel algorithm or Goldberg-Tarjan algorithm

Algorithmic problem: max-flow problem (standard version)

Type of algorithm: loop.

Auxiliary data:

1. A nonnegative integral value  for each node .
2. Each node  has a current arc, which may be implemented as an iterator on the list of outgoing residual arcs of .
3. The excess  of a node  with respect to the current preflow.
4. A (dynamically changing) set  of nodes.

Invariant: Before and after each iteration:

1. For each arc , it is  . If all upper bounds are integral, all -values are integral, too.
2. For each node , it is . In other words,  is a preflow.
3. The node labels  form a valid distance labeling, and it is .
4. The currently active nodes are stored in .
5. The current arc of a node is an outgoing arc of the node's in the residual graph. In the list of all of these arcs, no admissible arc precedes the current arc.

Variant: No label  is ever decreased. In each iteration, one of the following three actions will take place:

1. The label  of at least one node  is increased.
2. A saturating push is performed.
3. The value of  decreases.

Break condition: .

## Induction basis

Abstract view:

1. For all arcs , set .
2. For each arc , overwrite this value by  and put  into .
3. Compute a valid distance labeling  for  with respect to , for example, the true distances from all nodes to  in the residual network of .
4. Set .
5. For all , reset the current arc of  so as to point to the first arc in the list of outgoing arcs of .

Proof: For the subgraph induced by , the arguments in the correctness proof for the Ahuja-Orlin algorithm prove that the -labels form a valid distance labeling here as well. For , nothing is to show because all outgoing arcs are saturated.

## Induction step

Abstract view:

1. Choose an active node  from .
2. While the current arc of  is not void and not admissible either, move the current arc one step forward.
3. If the current arc of  is not void now but an (admissible) outgoing arc , say:
1. If  and  and , insert  in .
2. Increase the flow over  by the minimum of  and the residual capacity of .
3. Increase  by that value and decrease  by the same value.
4. If  now, extract  from .
4. Otherwise:
1. Let  denote the minimal label  of any arc  in the residual network.
2. Set .
3. Reset the current arc of  so as to point to the beginning of the list of outgoing arcs of .

Remark: The preflow-push algorithm is also known as the push-relabel algorithm. The push operation is step 3; the relabel operation is step 4.

Proof: Points 1, 2, and 4 of the invariant and  are obviously fulfilled. The rest of point 3 of the invariant is affected by step 4 only, and the outgoing arcs of  are the only arcs where the distance labeling may become invalid. However, the extremely conservative increase of  ensures point 3 of the invariant.

To prove the variant, consider a step in which neither any -value is increased nor a saturating push is performed. This means step 3.2 is applied, but the arc  is not saturated by that. Potentially,  becomes active. However,  definitely becomes inactive since the push step is non-saturating. Now the variant follows from the fact that  for an admissible arc .

It remains to show termination; this is proved by the following complexity considerations.

## Complexity

Statement: The asymptotic complexity is in , where  and .

Proof: First we show that the total number of relabel operations (step 4 of the main loop) is in . To see that, let  be an active node between two iterations of the main loop. A straightforward induction over the number of push operations shows that there is at least one simple -path  with positive flow on all arcs. The transpose of  is augmenting. Due to the validity of  (induction hypothesis),  cannot be larger than the number of arcs on , which is not larger than . Therefore, no node label can be larger than . Since node labels are nonnegative and increase at least by one in each relabel operation, the claimed upper bound on the relabel operations follows.

From this bound, we may immediately conclude that the current arc of a node is reset  times, so the total number of forward steps of the current arcs of all nodes is in .

The argument in the complexity analysis of the Ahuja-Orlin algorithm to prove that the total number of saturating push operations is in , applies here as well.

Finally, we consider the non-saturating push operations. First note that  before and after each iteration. The value of  is increased in each relabel operation exactly by the amount by which the label of the current node is increased. Since node labels are never decreased and bounded from above by ,  increases by less than  in total over all relabel operations. On the other hand, a saturating push operation may increase  by at most  (namely, in the case that  was not active immediately before the push). In summary, the total sum of all values by which  is increased throughout the algorithm is in . Due to the variant, the value of  is decreased by at least one in each non-saturating push operation. This proves the claim.

## Heuristic speedup techniques

1. After  iterations of the main loop, the -values are recomputed analogously to the induction basis: as the current distance of each node to  in the residual network. This modification is seldom enough, so the asymptotic complexity is not increased. In practice, this technique may save many unnecessary relabel steps.
2. The main loop may be decomposed into two phases: First, as much flow as possible is sent into ; second, all surplus flow that cannot reach  is sent back to . The first phase may be finished once there is no more path in the residual network from any active node to . A sufficient and easy-to-check condition for that is  for all active nodes . All nodes from which  is reachable may be safely disregarded in the second phase. For any other node, to save unnecessary relabel operations, the distance label may be safely increased to the minimum number of arcs in the residual network from this node back to .