Professional Documents
Culture Documents
Program ▶ Institution:
Chapter blueprint
We firstly present Minimum-cost flow (MCF) on weighted directed graphs, then discuss the Successive shortest
path algorithm (Successive SPA). Briefly speaking, the successive shortest path algorithm searches for the maximum
The input to our problem consists of a flow network 𝐺 = (𝑉, 𝐸) of 𝑛 nodes and 𝑚 edges, where each edge 𝑒
has a cost 𝐴(𝑒), in addition to the usual edge capacities 𝐶(𝑒) and vertex balances. Edge costs can be positive,
∑︁
𝐴(𝑓 ) = 𝐴(𝑒) 𝑓 (𝑒)
𝑒∈𝐸
(1) the cost function 𝐴 ≡ 𝑎 : 𝐸 −→ R should fulfil that 𝐴(𝑒) ≥ 0 for all 𝑒 ∈ 𝐸 , and
(2) 𝐺 could be pre-defined with or without special source and target vertices.
(3) We will also need a capacity function 𝐶 ≡ 𝑐 : 𝐸 −→ R s.t. 𝐶(𝑒) ≥ 0 for all 𝑒 ∈ 𝐸 .
Relationships of the flow 𝑓 , the cost 𝐴 and the capacity function 𝐶 are described in Section 2.1.
If allow one source and one target then the source 𝑠 and the sink 𝑡 are marked.
∑︀ ∑︀
(4) The node-balance at each internal node means 𝑣∈𝑉 𝑓 (𝑣, 𝑢) = 𝑣∈𝑉 𝑓 (𝑢, 𝑣), for 𝑢 ̸= 𝑠, 𝑡.
Figure 1.1: Supply nodes are the left ones, demand nodes are the right ones
1/ General: The optimal-cost flow problem (OCF) without fixed total flow quantity asks for a feasible flow with
2/ The minimum-cost flow problem (MinCF) with a given value 𝐾 , a total flow quantity from 𝑠 to 𝑡, we have to
find a flow of this quantity, and among all flows of this value 𝐾 we choose the flow with the lowest cost 𝐶(𝑓 ).
* Sometimes the task is given a little differently: you want to find the maximum flow, and among all maximal flows
we want to find the one with the least cost. This is called the minimum-cost maximum-flow problem. Both these
problems can be solved effectively with the algorithm of successive shortest paths.
The MinCF algorithm is very similar to the Edmonds-Karp for computing the maximum flow, originally raised by
the residual network 𝐺𝑓 consisting of all edges 𝑒 = 𝑢 → 𝑣 with non-zero residual capacity 𝑟𝑐(𝑒), 1 .
Simplest case of MinCF: First we assume the graph is oriented, and there is at most one edge between any pair
of vertices (e.g. if (𝑖, 𝑗) is an edge in the graph, then (𝑗, 𝑖) cannot be part in it as well).
Let 𝐶𝑖𝑗 be the capacity of an edge (𝑖, 𝑗) if this edge exists, and 𝐴𝑖𝑗 be the cost per unit of flow along this edge.
And finally let 𝐹𝑖,𝑗 be the flow along the edge (𝑖, 𝑗). Initially all flow values are zero.
We modify the network as follows: for each edge (𝑖, 𝑗) we add the reverse edge (𝑗, 𝑖) to the network
with the capacity 𝐶𝑗𝑖 = 0 and the cost 𝐴𝑗𝑖 = −𝐴𝑖𝑗 . Since, according to our restrictions, the edge (𝑗, 𝑖) was
not in the network before, we still have a network that is not a multigraph (graph with multiple edges).
In addition we will always keep the condition 𝐹𝑗𝑖 = −𝐹𝑖𝑗 true during the steps of the algorithm. Define the residual
network for some fixed flow 𝐹 = 𝑓 as follow (just like in the Ford-Fulkerson algorithm- see Chapter 2).
1see https://cp-algorithms.com/graph/edmonds-karp.html].
A reminder of original algorithms by Ford-Fulkersonis given in Chapter 2.
Chapter 2 provides more details of Ford-Fulkerson: the residual network contains only unsaturated edges (i.e.
edges in which 𝐹𝑖𝑗 < 𝑈𝑖𝑗 ), and the residual capacity of each such edge is 𝑅𝑖𝑗 = 𝑈𝑖𝑗 − 𝐹𝑖𝑗 .]
Their algorithm (concepts to computation) solves Maximum flow problem, but now we can briefly modify it to the
At each algorithm’s iteration we find the shortest path in the residual graph from 𝑠 to 𝑡. In contrary to Ford-
Fulkerson we look for the shortest path in terms of the cost of the path, instead of the number of edges.
1. If there doesn’t exists a path anymore, then the algorithm terminates, and the stream 𝐹 is the desired one.
2. If a path was found, we increase the flow along it as much as possible (i.e. we find the minimal residual capacity 𝑅
of the path, and increase the flow by it, and reduce the back edges by the same amount).
3. If at some point the flow reaches the value 𝐾 , then we stop the algorithm.
Note that in the last iteration of the algorithm it is necessary to increase the flow by only such an amount so that
FACT: If we set 𝐾 = ∞, then the algorithm will find the minimum-cost maximum-flow. So both variations of the
The case of an undirected graph or a multigraph doesn’t differ conceptually from the algorithm above. The algorithm
will also work on these graphs. However it becomes a little more difficult to implement it.
An undirected edge (𝑖, 𝑗) is actually the same as two oriented edges (𝑖, 𝑗) and (𝑗, 𝑖) with the same capacity and
values. Since the above-described minimum-cost flow algorithm generates a back edge for each directed edge, so
it splits the undirected edge into 4 directed edges, and we actually get a multigraph.
1. First the flow for each of the multiple edges must be kept separately.
2. Secondly, when searching for the shortest path, it is necessary to take into account that it is important which of the
multiple edges is used in the path. Thus instead of the usual ancestor array we additionally must store the edge
3. Thirdly, as the flow increases along a certain edge, it is necessary to reduce the flow along the back edge. Since
we have multiple edges, we have to store the edge number for the reversed edge for each edge.
The Successive shortest path algorithm (Successive SPA) is based on the theory of Maximum flow problems
initially proposed by Ford and Fulkerson in the mid-1950s, see next Chapter 2. Later it - the Successive SPA was
rediscovered by William Jewell in 1958, Masao Iri in 1960, and Robert Busacker and Paul Gowen in 1960 2.
The Successive SPA is formulated on a general flow network 𝐺 = (𝑉, 𝐸) with capacities 𝑓 (.), lower bounds, costs
𝐶(.) on edges, and balances (flow in equal to flow out at any node). Assumption below are satisfied
1. Edges have non-negative capacities and zero lower bounds: 0 ≤ 𝑓 (𝑢, 𝑣) ≤ 𝑐(𝑢, 𝑣), for all (𝑢, 𝑣) ∈ 𝐸
2. Every flow 𝑓 must satisfy the conservation constraint, namely In-flow equals out-flow at each internal node:
∑︀ ∑︀ ∑︀ ∑︀
𝑣∈𝑉 𝑓 (𝑣, 𝑢) = 𝑣∈𝑉 𝑓 (𝑢, 𝑣) ⇔ 𝑣∈𝑉 𝑓 (𝑣, 𝑢) − 𝑣∈𝑉 𝑓 (𝑢, 𝑣) = 0, for 𝑢 ̸= 𝑠, 𝑡
It means all node balances are zero, and so any feasible flow in such a network is actually a circulation- a sum of
directed cycles. This special case is normally called the Minimum- cost circulation or just shortly MinCF problem.
2link https://scholar.archive.org/work/m5jyzp64rraijldhzojde7ud3i
Successive Shortest Paths (Successive SP) are used to solve any instance of the Minimum-cost circulation -
Minimum- cost flow problem using a natural generalization of the well-known Ford-Fulkerson augmenting path
algorithm. Successive SP essentially are built on the cycle canceling algorithm 3 and the pseudo-flow, defined below.
Definition 1.1
A pseudo-flow 𝜓 : 𝐸 −→ R is a minimum-cost flow if and only if it satisfies three conditions: ♣
Remind that, any residual network 𝐺𝑓 consists of all edges 𝑒 = 𝑢 → 𝑣 with non-zero residual capacity cf 𝑟𝑐(𝑒).
KEY: The cycle-canceling algorithm incrementally improves a feasible and balanced pseudoflow 𝜓 : 𝐸 −→ R
A complementary strategy called successive shortest paths incrementally improves a feasible and locally optimal
Step 1: For each residual edge 𝑒 = 𝑢 → 𝑣 in 𝐺𝑓 that is not an edge in the original graph 𝐺, we define its cost
𝐴(𝑢 → 𝑣) = −𝐴(𝑣 → 𝑢)
Step 2: Now let 𝛾 be a directed cycle in the residual graph 𝐺𝑓 . We define the residual capacity 𝑟𝑐𝑓 (𝛾) of 𝛾 to be
the minimum residual capacity of the edges in 𝛾 , and the cost 𝐴(𝛾) of 𝛾 to be the sum of the costs of the edges in 𝛾 :
∑︁
𝑟𝑐𝑓 (𝛾) := min 𝑟𝑐𝑓 (𝑒); 𝐴(𝛾) = 𝐴(𝑒)
𝑒∈𝛾
𝑒∈𝛾
Step 3:
3A/ Exactly as in Ford-Fulkerson idea, we can augment the circulation 𝑓 , by pushing 𝑅 units of flow around 𝛾 , to
⎧
⎪
𝑓 (𝑢 → 𝑣) + 𝑟𝑐𝑓 (𝛾) if 𝑢 → 𝑣 ∈ 𝛾
⎪
⎪
⎪
⎪
⎪
⎨
𝑓 * (𝑢 → 𝑣) = 𝑓 (𝑢 → 𝑣) − 𝑟𝑐𝑓 (𝛾) if 𝑣 → 𝑢 ∈ 𝛾 (1.1)
⎪
⎪
⎪
⎪
⎩𝑓 (𝑢 → 𝑣)
⎪
⎪ otherwise
SUMMARY-
1. In particular, if 𝐴(𝛾) < 0, the new circulation 𝑓 * has lower cost than the original circulation 𝑓 . We conclude that
Essence: Klein’s cycle canceling algorithm initializes 𝑓 to the all-zero circulation, and then repeatedly augments 𝑓
along an arbitrary negative residual cycle, until there are no more negative residual cycles.
The desirable pseudo-flow 𝜓 [Definition 1.1] is just the newly constructed flow 𝑓 * on the found net 𝐺𝑓 .
2. For the special instances generated by our reduction from maximum flow, every negative-cost residual cycle con-
sists of a path from source 𝑠 to sink 𝑡 and the sole negative edge 𝑡 → 𝑠, so Cycle canceling is equivalent to Ford
and Fulkerson’s augmenting path algorithm. The whole ideas give the name Successive shortest paths algorithm!
ELUCIDATION to Algorithms
The successive shortest paths algorithm requires two simplifying assumptions about the initial flow network 𝐺:
(1) All lower bounds are zero: Otherwise, think of the lower-bound function 𝑙 as a pseudoflow (sending 𝑙(𝑒) units
of flow across each edge e), and consider the residual graph G‘ .
Enforcing these assumptions may introduce non-zero balances at the nodes, even if all balances in the initial flow
network are zero. These two assumptions imply that the all-zero pseudo-flow (a newly set up 𝜓 ) is both feasible
construct 𝐺𝜓
Augment(𝑠, 𝑡, 𝜎 )
ALGORITHM 2 - Augment(𝑠, 𝑡, 𝜎 )
2. 𝐵 ←− 𝐵 − 𝑅
if 𝑒 ∈ 𝐸
𝜓(𝑒) ←− 𝜓(𝑒) + 𝑅
else # <𝑟𝑒𝑣(𝑒) ∈ 𝐸>
𝜓(𝑒) ←− 𝜓(𝑒) − 𝑅
Lemma 1.1
♡
the feasible pseudoflow 𝜓 is locally optimal; that is, the residual graph 𝐺𝜓 contains no negative cycles.
Proof By induction.
Chapter blueprint
* Coutersy of FCSE statfs at HCMUT (the lecture note of Discrete Structure for CS).
Given data
A directed graph 𝑁 = (𝑉, 𝐴) describes a transport network, with source node 𝑠 and sink node 𝑡,
Send as much flow as possible with flow 𝑓 : 𝐸 −→ 𝑅+ such that Assumption below are satisfied
Flow Algorithms
Let 𝑓 be a flow for a transport network 𝑁 = (𝑉, 𝐴) with a given underlying undirected graph 𝐺 = (𝑉, 𝐸) associated
with 𝑁 .
∑︁
𝑣𝑎𝑙(𝑓 ) = 𝑓 (𝑠, 𝑣)
𝑣∈𝑉
c) If 𝐶 is a cut-set for the undirected graph 𝐺 then C is called a cut, or an 𝑠 − 𝑡 cut, if the removal of the edges in
This cut partitions the vertices of 𝑁 into the two sets 𝑃 ⊂ 𝑉 and its complement 𝑃 𝑐
∑︁
𝑐(𝑃, 𝑃 𝑐 ) = 𝑐(𝑣, 𝑤) (2.1)
𝑣∈𝑃,𝑤∈𝑝𝑐
Using the idea of the capacity of a cut, this next result provides an upper bound for the value of a flow in a network.
Theorem 2.1
A. Let 𝑓 be a flow in a transport network 𝑁 = (𝑉, 𝐴). ♡
If 𝐶 = (𝑃, 𝑃 𝑐 ) is any cut in 𝑁 then the value of the flow can not exceed the capacity of that cut:
∑︁ ∑︁
𝑣𝑎𝑙(𝑓 ) = 𝑓 (𝑠, 𝑣) ≤ 𝑐(𝑃, 𝑃 𝑐 ) = 𝑐(𝑣, 𝑤). (2.2)
𝑣∈𝑉 𝑣∈𝑃,𝑤∈𝑃 𝑐
Lester R. Ford, Jr., and Delbert Ray Fulkerson invented the algorithm, see originally in Network Flow Theory, the RAND Corporation, 1956, or full
∑︁
𝑣𝑎𝑙(𝑓 ) = 𝑓 (𝑠, 𝑣) ≤ 𝑐(𝑃, 𝑃 𝑐 ),
𝑣∈𝑉
ie. the value for any flow 𝑓 is less than or equal to the capacity of any cut 𝐶 in that network.
Hence the value of the maximum flow cannot exceed the minimum capacity over all cuts in a network,
How to construct such a flow and why its value equals the minimum capacity among all cuts will be dealt with in
Proof Theorem A: see original papers by Ford and Fulkerson [1956, 1962], or Theorem 13.3 in Grimaldi 1
Key Theorem B
Theorem 2.2
B. Assume 𝑓 be a flow in a transport network 𝑁 = (𝑉, 𝐴). ♡
1. Then the value of the flow from the source 𝑠 is equal to the value of the flow into the sink 𝑡.
2. Now let 𝐶 = (𝑃, 𝑃 𝑐 ) be a cut in 𝑁 such that val(f ) = f (s, v) = c(P, Pc ) then
∑︀
v∈V
HINT for proving (1): Let 𝑃 = {𝑠}, and 𝑄𝑐 = {𝑡}, then 𝑃 𝑐 = 𝑉 ∖ 𝑃 , and 𝑄 = 𝑉 ∖ 𝑄𝑐 . Just prove that
∑︁ ∑︁
𝑓 (𝑠, 𝑣) = 𝑣𝑎𝑙(𝑓 ) = 𝑓 (𝑦, 𝑡)
𝑣∈𝑃 𝑐 𝑦∈𝑄
Proving (2): we use Theorem A by choosing any flow 𝑓1 and any cut (𝑄, 𝑄𝑐 ),
f (s, v) = c(P, Pc )?
∑︀
Key Theorem C: But when val(f ) = v∈V
Theorem 2.3
C. Conditions of max flow meeting min cut ♡
For a transport network 𝑁 = (𝑉, 𝐴), with a source 𝑠 and a sink 𝑡, let 𝑓 be a flow and (𝑃, 𝑃 𝑐 ) be a cut.
1. 𝑓 (𝑒) = 𝑐(𝑒) for each arc 𝑒 = (𝑥, 𝑦), where 𝑥 ∈ 𝑃 and 𝑦 ∈ 𝑃 𝑐 , and