Each drop of water has its [*quality*]{} and each drop that travels through edge $e$ looses $f_2(e)$ of its quality. Each vertex $P$ of the graph has a label $L(P)$ that corresponds to the quality of water that is at the vertex $P$. Initially all vertices in $A$ have label $M$ while all other vertices have label $0$. The drops that get their quality reduced to $0$ cannot travel any further. The time at which a vertex from $B$ receives its first drop of water is exactly the minimal $F_1\left(\pi\right)$ under the constraint $F_2(\pi)<M$.

Some vertices and edges in the graph are considered [*active*]{}. Initially, the vertices in $A$ are [*active*]{}. All edges adjacent to them are also called [*active*]{}. Each cycle in algorithm corresponds to one unit of time. During one cycle the water flows through active edges and decrease their time components by $1$. Once an edge gets its time component reduced to $0$, the edge becomes [*used*]{} and we look at the source $S$ and the destination $D$ of this water flow through the edge $e$. The destination $D$ becomes [*triggered*]{}, and its label will be [*corrected*]{}. The label correction is straight-forward if the edge $D$ was 