|
ADS
Algorithms and Data Structures
|
The maximum flow of section 15.2 in a network \( G = ( V , E , s , t , c ) \), with integer capacities, and the minimum cut. More...
#include "ADS/Contract.h"#include <algorithm>#include <cstddef>#include <limits>#include <vector>#include "ADS/graph/impl/MaxFlow.tpp"#include "ADS/graph/PushRelabel.h"Go to the source code of this file.
Classes | |
| class | ADS::FlowNetwork |
| a network of flow with integer capacities More... | |
| struct | ADS::BoundedEdge |
| an edge \( ( u , v ) \) with lower and upper bounds on its flow More... | |
Namespaces | |
| namespace | ADS |
Enumerations | |
| enum class | ADS::Augment { ADS::Augment::FORD_FULKERSON , ADS::Augment::EDMONDS_KARP , ADS::Augment::DINIC , ADS::Augment::PUSH_RELABEL } |
| the way of increasing the flow More... | |
Functions | |
| bool | ADS::feasibleCirculation (int n, const std::vector< BoundedEdge > &E, std::vector< long long > *flows=nullptr) |
| whether the edges admit a circulation, a flow conserved at every node with \( \mathit{low} \le f( e ) \le \mathit{high} \); then the flows in *flows, if given | |
The maximum flow of section 15.2 in a network \( G = ( V , E , s , t , c ) \), with integer capacities, and the minimum cut.
The network keeps for each edge its residual twin, so that the residual capacity \( c_f( u , v ) = c( u , v ) - f( u , v ) \) of both directions is at hand. By Theorem 15.1 (maximum flow / minimum cut) \( f \) is maximum if and only if there is no augmenting path, a path from \( s \) to \( t \) in the residual network, and then the nodes \( S \) reached from \( s \) give a cut \( ( S , V \setminus S ) \) of capacity \( | f | \). The local search augments the flow along augmenting paths:
The best bound that the book attributes to Karmarkar (1984), \( O( n m \log( n^2 / m ) ) \), is the one of the push-relabel of Goldberg and Tarjan (1988) with the dynamic trees; Karmarkar's is the interior point method for linear programming. Every way starts from the flow there is, and setCapacity() may lower a capacity below the flow of its edge, which leaves an excess and a deficit for the next maxFlow() to route first (the reparametrization of the dynamic cuts of Kohli and Torr), so that a flow is reoptimized after any change of the capacities [see MaxFlowObserver of Reoptimization.h]. feasibleCirculation() decides whether a circulation with lower and upper bounds on the edges exists, by a maximum flow from a new source that gives each node the lower bounds entering it.
The contracts [see Contract.h]: a network has \( n \ge 0 \) nodes, an edge joins two of them with a capacity \( c \ge 0 \), maxFlow() needs two distinct nodes; the invariant is the skew symmetry of the flow on each edge and its twin, within the capacity. At the level of the audits maxFlow() ensures that no augmenting path is left, and feasibleCirculation() that the flows it gives are within the bounds and conserved at every node. The operations are defined in MaxFlow.tpp.