
In optimization theory, maximum flow problems involve finding a feasible flow through a flow network that obtains the maximum possible flow rate.
The maximum flow problem can be seen as a special case of more complex network flow problems, such as the circulation problem. The maximum value of an s-t flow (i.e., flow from source s to sink t) is equal to the minimum capacity of an s-t cut (i.e., cut severing s from t) in the network, as stated in the max-flow min-cut theorem.
The maximum flow problem was first formulated in 1954 by T. E. Harris and F. S. Ross as a simplified model of Soviet railway traffic flow.[1] [2] [3] In 1955, Lester R. Ford, Jr. and Delbert R. Fulkerson created the first known algorithm, the Ford–Fulkerson algorithm.[4] [5] In their 1955 paper, Ford and Fulkerson wrote that the problem of Harris and Ross is formulated as follows (see p. 5):
Consider a rail network connecting two cities by way of a number of intermediate cities, where each link of the network has a number assigned to it representing its capacity. Assuming a steady state condition, find a maximal flow from one given city to the other.In their book Flows in Networks, in 1962, Ford and Fulkerson wrote:
It was posed to the authors in the spring of 1955 by T. E. Harris, who, in conjunction with General F. S. Ross (Ret.), had formulated a simplified model of railway traffic flow, and pinpointed this particular problem as the central one suggested by the model [11].where [11] refers to the 1955 secret report Fundamentals of a Method for Evaluating Rail net Capacities by Harris and Ross (see p. 5).
Over the years, various improved solutions to the maximum flow problem were discovered, notably the shortest augmenting path algorithm of Edmonds and Karp and independently Dinitz; the blocking flow algorithm of Dinitz; the push-relabel algorithm of Goldberg and Tarjan; and the binary blocking flow algorithm of Goldberg and Rao. The algorithms of Sherman[6] and Kelner, Lee, Orecchia and Sidford,[7] [8] respectively, find an approximately optimal maximum flow but only work in undirected graphs.
In 2013 James B. Orlin published a paper describing an
O(|V||E|)
In 2022 Li Chen, Rasmus Kyng, Yang P. Liu, Richard Peng, Maximilian Probst Gutenberg, and Sushant Sachdeva published an almost-linear time algorithm running in
O(|E|1+o(1))
First we establish some notation:
N=(V,E)
s,t\inV
N
g
N
(u,v)\inE
guv
g(u,v).
Definition. The capacity of an edge is the maximum amount of flow that can pass through an edge. Formally it is a map
c:E\to\R+.
Definition. A flow is a map
f:E\to\R
fuv\leqcuv
(u,v)\inE.
\forallv\inV\setminus\{s,t\}:
| \sum | |
| u:(u,v)\inE,fuv>0 |
fuv=
| \sum | |
| u:(v,u)\inE,fvu>0 |
fvu.
Remark. Flows are skew symmetric:
fuv=-fvu
(u,v)\inE.
Definition. The value of flow is the amount of flow passing from the source to the sink. Formally for a flow
f:E\to\R+
|f|=\sumv: (s,v)fsv=\sumu: (u,t)fut.
Definition. The maximum flow problem is to route as much flow as possible from the source to the sink, in other words find the flow
frm{max}
Note that several maximum flows may exist, and if arbitrary real (or even arbitrary rational) values of flow are permitted (instead of just integers), there is either exactly one maximum flow, or infinitely many, since there are infinitely many linear combinations of the base maximum flows. In other words, if we send
x
u
y>x
u
\Delta\in[0,y-x]
x+\Delta
u
\Delta
x,y
The following tables show the historical development of algorithms for solving the maximum flow problem. Many of the listed publications include similar tables comparing their results to earlier works.
A strongly-polynomial time algorithm has polynomial time bounds that depend only on the number of inputs, but do not depend on the magnitude of these numbers. Here, the inputs are the vertices (numbered below as
V
E
| Method | Year | Complexity | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Edmonds–Karp algorithm[14] | 1969 | O(VE2) | A specialization of Ford–Fulkerson, finding augmenting paths with breadth-first search. | |||||||
| Dinic's algorithm[15] | 1970 | O(V2E) O(min\{V2/3,E1/2\}E) | Repeated phases that build a "layered" subgraph of residual graph edges belonging to shortest paths, using breadth-first search, and then find a blocking flow (a maximum flow in this layered graph) in time O(VE) V-1 | |||||||
| Karzanov's algorithm[16] | 1974 | O(V3) | A predecessor to the push-relabel algorithm using preflows (flow functions allowing excess at vertices) to find a blocking flow in each phase of Dinic's algorithm in time O(V2) | |||||||
| Cherkassky's algorithm[17] | 1977 | Ol(V2\sqrt{E}r) | Combines the blocking flow methods of Dinic (within blocks of consecutive BFS layers) and Karzanov (to combine blocks). The first subcubic strongly polynomial time bound for sparse graphs. Remained best for some values of E | |||||||
| Malhotra, Kumar, and Maheshwari[18] | 1978 | O(V3) | Not an improvement in complexity over Karzanov, but a simplification. Finds blocking flows by repeatedly finding a "reference node" of the layered graph and a flow that saturates all its incoming or outgoing edges, in time proportional to the number of nodes plus the number of saturated edges. | |||||||
| Galil's algorithm[19] | 1978 | O(V5/3E2/3) | Modifies Cherkasky's algorithm by replacing the method for finding flows within blocks of consecutive layers. | |||||||
| Galil, Naamad, and | 1978 | Ol(VE(logV)2r) | Uses tree contraction on a breadth-first search forest of the layered graph to speed up blocking flows. The first of many O(VE\operatorname{polylog}V) | |||||||
| Blocking flow with link/cut trees.[20] | 1981 | O(VElogV) | Introduces the link/cut tree data structure and uses it to find augmenting paths in layered networks in logarithmic amortized time per path. | |||||||
| Push–relabel algorithm with link/cut trees[21] | 1986 | O\left(VElog
\right) | The push-relabel algorithm maintains a preflow, and a height function estimating residual distance to the sink. It modifies the preflow by pushing excess to lower-height vertices and increases the height function at vertices without residual edges to lower heights, until all excess returns to the source. Link/cut trees allow pushes along paths rather than one edge at a time. | |||||||
| Cheriyan and Hagerup[22] | 1989 | randomized, Ol(VE+V2(logV)2r) | Push-relabel on a subgraph to which one edge is added at a time, prioritizing pushes of high excess amounts, with randomly permuted adjacency lists | |||||||
| Alon[23] | 1989 | O(VE+V8/3logV) | Derandomization of Cheriyan and Hagerup | |||||||
| Cheriyan, Hagerup, and Mehlhorn[24] | 1990 | \displaystyleO\left(
\right) | Uses Alon's derandomization of Cheriyan and Hagerup with ideas related to the Method of Four Russians to speed up the search for height-reducing edges on which to push excess. | |||||||
| King, Rao, and Tarjan[25] | 1992 | O(VE+V2+\varepsilon) for any \varepsilon>0 | Another derandomization of Cheriyan and Hagerup. Preliminary version of King, Rao, and Tarjan 1994 with weaker bounds. | |||||||
| Phillips and Westbrook[26] | 1993 | O(VElogE/VV+V(logV)2+\varepsilon) for any \varepsilon>0 | Improved from King, Rao, and Tarjan 1992 using similar ideas. | |||||||
| King, Rao, and Tarjan[27] | 1994 | O\left(VE
V\right) | Improved from Phillips and Westbrook using similar ideas. | |||||||
| Orlin[28] | 2013 | O(VE) | Applies a pseudopolynomial algorithm of Goldberg and Rao to a compressed network, maintained using data structures for dynamic transitive closure. Takes time Or(VE+E31/16(logV)2r) O(VE) E=O(V16/15) O(VE) E=\Omega(V1+\epsilon) | |||||||
| Orlin and Gong[29] | 2021 | \displaystyleO\left(
{V}}\right) | Based on a pseudopolynomial algorithm of Ahuja, Orlin, and Tarjan. Faster than King, Rao, and Tarjan and does not use link/cut trees, but not faster than Orlin + KRT. |
In parallel to the development of strongly-polynomial flow algorithms, there has been a long line of pseudo-polynomial and weakly polynomial time bounds, whose running time depends on the magnitude of the input capacities. Here, the value
U
U
logU
| Method | Year | Complexity | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Ford–Fulkerson algorithm[30] | 1956 | O(EU) | As long as there is an open path through the residual graph, send the minimum of the residual capacities on that path. | |||||||||||
| Binary blocking flow algorithm[31] | 1998 | O\left(E ⋅ min\{V2/3,E1/2\} ⋅ log
⋅ logU\right) | ||||||||||||
| Kathuria-Liu-Sidford algorithm[32] | 2020 | E4/3+o(1)U1/3 | Interior point methods and edge boosting using \ellp \tildeO(E10/7U1/7) | |||||||||||
| BLNPSSSW / BLLSSSW algorithm[34] [35] | 2020 | \tildeO((E+V3/2)logU) | Interior point methods and dynamic maintenance of electric flows with expander decompositions. | |||||||||||
| Gao-Liu-Peng algorithm[36] | 2021 | \tilde
| Gao, Liu, and Peng's algorithm revolves around dynamically maintaining the augmenting electrical flows at the core of the interior point method based algorithm from [Mądry JACM ‘16]. This entails designing data structures that, in limited settings, return edges with large electric energy in a graph undergoing resistance updates. | |||||||||||
| Chen, Kyng, Liu, Peng, Gutenberg and Sachdeva's algorithm[37] | 2022 | O(E1+o(1)logU) E\expO(log7/8EloglogE)logU | Chen, Kyng, Liu, Peng, Gutenberg and Sachdeva's algorithm solves maximum flow and minimum-cost flow in almost linear time by building the flow through a sequence of E1+o(1) Eo(1) | |||||||||||
| Bernstein, Blikstad, Saranurak, Tu[38] | 2024 | O(n2logU) \{1,...,U\} | The algorithm is a variant of the push-relabel algorithm by introducing the weighted variant. The paper establishes a weight function on directed and acyclic graphs (DAG), and attempts to imitate it on general graphs using directed expander hierarchies, which induce a natural vertex ordering that produces the weight function similar to that of the DAG special case. The randomization aspect (and subsequently, the no(1) |
The integral flow theorem states that
If each edge in a flow network has integral capacity, then there exists an integral maximal flow.
The claim is not only that the value of the flow is an integer, which follows directly from the max-flow min-cut theorem, but that the flow on every edge is integral. This is crucial for many combinatorial applications (see below), where the flow across an edge may encode whether the item corresponding to that edge is to be included in the set sought or not.
Given a network
N=(V,E)
S=\{s1,\ldots,sn\}
T=\{t1,\ldots,tm\}
N
S
T
G=(X\cupY,E)
G
N=(X\cupY\cup\{s,t\},E')
E'
G
X
Y
(s,x)\inE'
x\inX
(y,t)\inE'
y\inY
c(e)=1
e\inE'
Then the value of the maximum flow in
N
G
1
G=(V,E)
V
G'=(Vrm{out}\cupVrm{in},E')
G
Vrm{out}=\{vrm{out}\midv\inV\landvhasoutgoingedge(s)\}
Vrm{in}=\{vrm{in}\midv\inV\landvhasincomingedge(s)\}
E'=\{(urm{out},vrm{in})\inVout x Vin\mid(u,v)\inE\}
Then it can be shown that
G'
M
m
G
C
m
n-m
n
G
G'
Assume we have found a matching
M
G'
C
uout,vin
M
(u,v)
C
C
m
C
vrm{out}
G'
M
v
C
v
C
v
C
vrm{in}
G'
v
C
v
C
C
C
To show that the cover
C
n-m
u
(u,v)\inE
v
(v,u)\inE
v
n
n
m
n-m
Let
N=(V,E)
c:V\to\R+,
f
\sumi\infiv\lec(v) \forallv\inV\backslash\{s,t\}.
In other words, the amount of flow passing through a vertex cannot exceed its capacity. To find the maximum flow across
N
N
v\inV
vin
vout
vin
v
vout
v
c(v)
vin
vout
Given a directed graph
G=(V,E)
s
t
s
t
1. The paths must be edge-disjoint. This problem can be transformed to a maximum flow problem by constructing a network
N=(V,E)
G
s
t
N
1
k
k
2. The paths must be independent, i.e., vertex-disjoint (except for
s
t
N=(V,E)
G
1
s
t
3. In addition to the paths being edge-disjoint and/or vertex disjoint, the paths also have a length constraint: we count only paths whose length is exactly
k
k
k
See main article: Closure problem. A closure of a directed graph is a set of vertices C, such that no edges leave C. The closure problem is the task of finding the maximum-weight or minimum-weight closure in a vertex-weighted directed graph. It may be solved in polynomial time using a reduction to the maximum flow problem.
In the baseball elimination problem there are n teams competing in a league. At a specific stage of the league season, wi is the number of wins and ri is the number of games left to play for team i and rij is the number of games left against team j. A team is eliminated if it has no chance to finish the season in the first place. The task of the baseball elimination problem is to determine which teams are eliminated at each point during the season. Schwartz[40] proposed a method which reduces this problem to maximum network flow. In this method a network is created to determine whether team k is eliminated.
Let G = (V, E) be a network with being the source and the sink respectively. One adds a game nodeij – which represents the number of plays between these two teams. We also add a team node for each team and connect each game node with i < j to V, and connects each of them from s by an edge with capacity rij – which represents the number of plays between these two teams. We also add a team node for each team and connect each game node with two team nodes i and j to ensure one of them wins. One does not need to restrict the flow value on these edges. Finally, edges are made from team node i to the sink node t and the capacity of is set to prevent team i from winning more than .Let S be the set of all teams participating in the league and let
r(S-\{k\})=\sumi,j\}\atopi<j}rij
In the airline industry a major problem is the scheduling of the flight crews. The airline scheduling problem can be considered as an application of extended maximum network flow. The input of this problem is a set of flights F which contains the information about where and when each flight departs and arrives. In one version of airline scheduling the goal is to produce a feasible schedule with at most k crews.
To solve this problem one uses a variation of the circulation problem called bounded circulation which is the generalization of network flow problems, with the added constraint of a lower bound on edge flows.
Let G = (V, E) be a network with as the source and the sink nodes. For the source and destination of every flight i, one adds two nodes to V, node si as the source and node di as the destination node of flight i. One also adds the following edges to E:
In the mentioned method, it is claimed and proved that finding a flow value of k in G between s and t is equal to finding a feasible schedule for flight set F with at most k crews.[41]
Another version of airline scheduling is finding the minimum needed crews to perform all the flights. To find an answer to this problem, a bipartite graph is created where each flight has a copy in set A and set B. If the same plane can perform flight j after flight i, is connected to . A matching in induces a schedule for F and obviously maximum bipartite matching in this graph produces an airline schedule with minimum number of crews.[41] As it is mentioned in the Application part of this article, the maximum cardinality bipartite matching is an application of maximum flow problem.
There are some factories that produce goods and some villages where the goods have to be delivered. They are connected by a networks of roads with each road having a capacity for maximum goods that can flow through it. The problem is to find if there is a circulation that satisfies the demand.This problem can be transformed into a maximum-flow problem.
Let G = (V, E) be this new network. There exists a circulation that satisfies the demand if and only if :
=\sumidi
The problem can be extended by adding a lower bound on the flow on some edges.[42]
In their book, Kleinberg and Tardos present an algorithm for segmenting an image.[43] They present an algorithm to find the background and the foreground in an image. More precisely, the algorithm takes a bitmap as an input modelled as follows: ai ≥ 0 is the likelihood that pixel i belongs to the foreground, bi ≥ 0 in the likelihood that pixel i belongs to the background, and pij is the penalty if two adjacent pixels i and j are placed one in the foreground and the other in the background. The goal is to find a partition (A, B) of the set of pixels that maximize the following quantity
q(A,B)=\sumiai+\sumibi-\sum\begin{matrixi,jadjacent\ |A\cap\{i,j\}|=1\end{matrix}}pij
Indeed, for pixels in A (considered as the foreground), we gain ai; for all pixels in B (considered as the background), we gain bi. On the border, between two adjacent pixels i and j, we loose pij. It is equivalent to minimize the quantity
q'(A,B)=\sumibi+\sumiai+\sum\begin{matrixi,jadjacent\ |A\cap\{i,j\}|=1\end{matrix}}pij
because
q(A,B)=\sumiai+\sumibi-q'(A,B).
We now construct the network whose nodes are the pixel, plus a source and a sink, see Figure on the right. We connect the source to pixel i by an edge of weight ai. We connect the pixel i to the sink by an edge of weight bi. We connect pixel i to pixel j with weight pij. Now, it remains to compute a minimum cut in that network (or equivalently a maximum flow). The last figure shows a minimum cut.
1. In the minimum-cost flow problem, each edge (u,v) also has a cost-coefficient auv in addition to its capacity. If the flow through the edge is fuv, then the total cost is auvfuv. It is required to find a flow of a given size d, with the smallest cost. In most variants, the cost-coefficients may be either positive or negative. There are various polynomial-time algorithms for this problem.
2. The maximum-flow problem can be augmented by disjunctive constraints: a negative disjunctive constraint says that a certain pair of edges cannot simultaneously have a nonzero flow; a positive disjunctive constraints says that, in a certain pair of edges, at least one must have a nonzero flow. With negative constraints, the problem becomes strongly NP-hard even for simple networks. With positive constraints, the problem is polynomial if fractional flows are allowed, but may be strongly NP-hard when the flows must be integral.[44]
O(n2\sqrt{p})
O(
O(V5/3E2/3)
o(n3)
o(nm)
O(m4/3)
n2