# Finding maximal flow in a transportation network

## 1 Formulation of the problem

A transportation network is a directed graph $G = (V, E)$ in which a nonnegative capacity $c(e) \ge 0$ is assigned to each edge $e \in E$. We assume that, along with each edge $e = (v, w) \in E$, the graph also contains the reverse edge $e^R = (w, v)$ (to which, if required, the zero capacity is assigned).

Let two vertices of a graph $G$ be marked, namely, the source $s$ and the sink $t$. It can be assumed without loss of generality that all the other vertices lie on a path from $s$ to $t$. A flow is a function $f: E \to \mathbb{R}$ that satisfies the following requirements:

• capacity constraint: $f(e) \le c(e)$;
• antisymmetry: $f(e^R) = -f(e)$;
• flow conservation law:
$\forall v \ne s, t: \quad \sum_{e = (w, v)} f(e) = \sum_{e = (v, w)} f(e).$

The value of flow is the total amount of flow from the source:

$\left \vert f \right \vert = \sum_{e = (s, v)} f(e).$

Maximal flow problem in a transportation network. It is required to find a flow with maximum value:

$\left \vert f \right \vert \to \max.$

## 2 Properties of the problem

The total flow out of the source is equal to the total flow into the sink:

$\forall v \ne s, t: \quad \sum_{e = (s, v)} f(e) = \sum_{e = (v, t)} f(e).$

(To prove this statement, it suffices to add up the flow conservation relations for all the vertices except for the source and sink.)

## 3 Variants of the problem

Depending on constraints on the capacity, the following cases may be distinguished:

• arbitrary positive capacity;
• integral capacity;
• unit capacity (in this case, the maximal flow is equal to the edge connectivity of the graph).

## 4 Algorithms for solving the problem

• The Ford-Fulkerson algorithm[1] and its versions [2][3] with the complexity $O(n^2m)$ (for Dinic's algorithm). In the case of integral capacity bounded by $K$, the complexity is $O(Km)$.
• The preflow push algorithm[4] The complexity is $O(mn \ln n)$ (provided that Sleator-Tarjan dynamic trees are used [5][6]).

Notation: $m$ is the number of edges, $n$ is the number of vertices.

## 5 References

1. Ford, L R, Jr., and D R Fulkerson. “Maximal Flow Through a Network.” Canadian Journal of Mathematics 8 (1956): 399–404. doi:10.4153/CJM-1956-045-5.
2. Edmonds, Jack, and Richard M Karp. “Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems.” Journal of the ACM 19, no. 2 (April 1972): 248–64. doi:10.1145/321694.321699.
3. Диниц, Е. А. “Алгоритм решения задачи о максимальном потоке в сети со степенной оценкой.” Доклады АН СССР 194, no. 4 (1970): 754–57.
4. Goldberg, Andrew V, and Robert Endre Tarjan. “A New Approach to the Maximum-Flow Problem.” Journal of the ACM 35, no. 4 (October 1988): 921–40. doi:10.1145/48014.61051.
5. Sleator, Daniel D, and Robert Endre Tarjan. “A Data Structure for Dynamic Trees,” STOC'81, 114–22, New York, USA: ACM Press, 1981. doi:10.1145/800076.802464.
6. Sleator, Daniel Dominic, and Robert Endre Tarjan. “Self-Adjusting Binary Search Trees.” Journal of the ACM 32, no. 3 (July 1985): 652–86. doi:10.1145/3828.3835.