



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The problem of maximum network flows, which involves finding a feasible flow with maximum size in a directed or undirected graph. The problem definition, conservation property, feasibility conditions, and the goal of the problem. It also explains how to find a maximum flow in an undirected graph by orienting its edges and how to use the ford-fulkerson algorithm to find a maximum flow in a directed graph. The document also discusses the concept of residual graphs and the relationship between the maximum flow and the minimum cut.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




CS787: Advanced Algorithms
Scribe: Blayne Field, Dan Rosendorf Lecturer: Shuchi Chawla Topic: Network Flows Date: Sept. 12 2007
In this lecture, we discussed the problem of maximum networks flows, which is a general problem to which many other problems can be reduced.
Given: A graph G = (V, E), which can be either directed or undirected, a capacity function c : E 7 → <+, along with a source s and a sink t. This can be thought of as a set of pipes, with the capacities being analogous to the cross-section of the pipe. The water is inserted into the network at the source s and ends up at the sink t. Our goal will be to find out what the maximum throughput of our network can be. Where by throughput in our analogy we mean the maximum amount of water per unit of time that can flow from s to t.
Let us now explain more precisely what we mean by our notation. In our problem we obviously need not consider loops in the graph (i.e. edges from v to v) since they add nothing to the throughput abilities of the system and we can also WLOG assume there are no multiple edges since if e 1 , e 2 are two edges from u to v with capacities c 1 , c 2 then we can represent them by one edge e with capacity c 1 + c 2.
This means that if we have a directed graph we can consider it to be in the form of some set V and a set E such that E ⊂ V × V. For an undirected graph we shall consider E to be a subset of [V ]^2 (the two element subsets of V ) by abuse of notation we shall still write (u, v) for an edge instead of the more correct {u, v}. Very soon we will see that we can actually restrict ourselves to only the case of the directed graph but first let us give a definition.
Definition 4.1.1 Let G = (V, E) be a directed or undirected graph, c be a capacity function on G and f : V × V 7 → R+. We say that f is a flow if the following holds:
∀v ∈ V (v 6 = s ∧ v 6 = t) → (
u∈V
f (u, v) =
u∈V
f (v, u))
In words for all nodes that are not the sink or source the amount of incoming flow is equal to the amount of outgoing flow, (i.e. there are no points of acummulation of flow) this is usually called the conservation property.
We say that a flow is feasible for G (or just feasible if the graph and capacity function in question are obvious) if
∀u, v ∈ V ((u, v) ∈ E) → (f (u, v) ≤ c((u, v))) ∧ ((u, v) 6 ∈ E) → (f (u, v) = 0)
In words the flow along any valid edge is smaller then that edge’s capacity.
We define the size of a flow f denoted |f | to be |f | =
u∈V f^ (s, u)^ −^
u∈V f^ (u, s)^ or all outgoing flow from s.
Goal: The goal is to find a feasible flow with maximum size.
Let us now notice a few things so we can from now on only consider directed graphs. Suppose we have an undirected graph G = (V, E) with a capacity function c. We then define G′^ to be the directed graph with vertices V and edges E′^ = {(u, v); {u, v} ∈ E}. In other words for each edge in our original graph we put in two edges going each way. We define c′^ : E′^7 → R+^ by c′((u, v)) = c({u, v}), which just means we set each of our two edges we created to have the same capacity as the one original edge.
Now we claim that the maximum flow in our new oriented graph has the same size as the maximum flow in our original graph and that it is easy to get the flow in the original graph from the flow in the new graph.
Lemma 4.1.2 Let G = (V, E) be an undirected graph and define G′^ as above. Let f 1 be a feasible flow in G and f 2 be a feasible flow in G′^ then there exist feasible flows f 1 ′ in G′^ and f 2 ′ in G such that |f 1 | = |f 1 ′| and |f 2 | = |f 2 ′|.
Proof: For f 1 define f 1 ′ to just be f 1. Then obviously the conservation properties still hold and since we made both directions of our new edge have the capacity of the original edge f 1 is still feasible. Since we have not changed anything |f 1 | = |f 1 ′|.
On the other hand for f 2 define f 2 ′(u, v) = max{ 0 , f 2 (u, v) − f 2 (v, u)} then th conservation property is still satisfied as one easilly check. Feasibility is satisfied thanks to the fact that f 2 is nonneg- ative and thus |f 2 (u, v) − f 2 (v, u)| is at most c((u, v)). The equality of size can be checked in a straightforward manner.
Definition 4.1.3 An s, t cut is a set of edges C such that the graph G′^ = (V, E \ C) contains no s, t path. The capacity of the cut is cap(C) =
e∈C c(e)
Note that an s, t cut defines a partition on the set of edges V into (S, S¯), such that s ∈ S and t ∈ S¯
Lemma 4.1.4 If we take F to be the set of all feasible flows, then for any s, t cut C, cap(C) ≥ maxf ∈F |f |.
Proof: Since C is a cut, any s, t path must contain at least one edge in C, thus any flow must have value less than cap(C).
Corollary 4.1.5 Let C∗^ be a minimum s, t cut of G and f ∗^ be a max flow of G, then cap(C∗) ≥ |f ∗|.
Using this corollary, we see that if we can exhibit a min-cut that equals the value of our flow, it serves as a certificate of the optimality of our flow. This is illustrated in our earlier example by the the cut below, which has a capacity of 6, the same as the value of our flow (see Figure 4.2.2).
Since greedy approaches often lead to an optimal solution, it seems natural to start trying to solve this problem with such an approach. We know that if we can find an s, t path with some positive capacity, we can increase the flow along that edge while maintaining feasability. This leads us to the following greedy approach:
Vf = V and Ef = {(u, v)|u, v ∈ V ∧ (c(u, v) > f (u, v))} ∪ {(u, v)|u, v ∈ V ∧ (f (v, u) > 0)}. We define cf (u, v) = c(u, v) − f (u, v) + f (v, u).
This means that for every edge in our original graph if it is saturated we remove it and we either add a new edge in the oposite direction with capacity equal to that of the flow or if there exists an edge in that direction we increase it’s capacity by the amount of the flow. For a non saturated edge we decrease it’s capacity by the amount of the flow and add the capacity of the flow to the edge going in the other direction. Figures 4.2.3 and 4.2.4 show a graph with a flow and it’s corresponding residual graph.
(1) (^) 3 (3) 1 (4)
1 (2) 2 (3)
1 (4) 3 (3)
s
t
Figure 4.2.3: A graph with a feasible flow Figure 4.2.4: Residual graph of the flow in the previous figure
We also define the addition of two flows in the obvious fashion.
Definition 4.2.2 Let f : V × V 7 → R+^ and f ′^ : V × V 7 → R+^ then we define g = f + f ′^ in the following manner. g(u, v) = max{ 0 , f (u, v) − f (v, u) + f ′(u, v) − f ′(v, u)}. It is obvious that the conservation property holds for g.
Let us now proceed to the Ford-Fulkerson algorithm.
The paths chosen in step 3 are called ”augmenting paths”.
Theorem 4.2.3 The Ford-Fulkerson algorithm described above finds the maximum flow if the ca- pacities are integers.
Proof: First note that at each step of the algorithm |f | increases by at least a unit thus the algorithm must terminate in a finite number of steps, since we have only a finite amount of capacity leaving the source.
Next we note that the flow created at every step is actually a feasible flow in the graph G. We show this by induction. It is obvious for the empty flow. Let fi is our flow at stage i which is feasible by hypothesis and suppose P is our s, t path and cfi,P is the minimum capacity along that path. Suppose (u, v) is any edge on the path P (obviously for edges outside the path feasibility is no problem).
We have cfi (u, v) = c(u, v) − fi(u, v) + fi(v, u). By the definition of the addition of flows we can see that any flow that is a sum of two flows has the property that if f (u, v) > 0 then f (v, u) = 0. If fi(u, v) > 0 then we have 0 < cfi (u, v) = c(u, v) − fi(u, v) from feasibility of fi and since cfi,P ≤ cfi (u, v) we get by simple algebra fi+1 ≤ c(u, v). If we have fi(v, u) > 0 then 0 < cfi (u, v) = c(u, v) + fi(v, u) and fi+1(u, v) is by definition either 0, or fi+1(u, v) = cfi,P − fi(v, u) which then by simple algebra yields fi+1(u, v) ≤ c(u, v).
To show that our resulting flow is a maximal flow first notice that S = {v; v ∈ V ∧ ( exists an s, v path in Gf )} along with it’s complement gives us an s, t cut C in G using the second definition. Otherwise we would have an s, t path in Gf which is a contradiction with the fact that the algorithm terminated. Next we wish to claim that the capacity of this cut is exactly equal to the size of our resulting flow fr.
By the definition of S we must have for any (u, v) ∈ C, fr(u, v) = c(u, v) since otherwise cfr (u, v) > 0 and thus we can get from s to v via some path. We also have for any (u, v) ∈ E where v ∈ S and u 6 ∈ S that fr(u, v) = 0 since otherwise cfr (v, u) = c(v, u) + fr(u, v) > 0 (since we know that only one of fr(u, v), fr(v, u) is non zero). Now this means that we have that the total flow exiting S is the capacity of C. Now
∑
u∈S
v∈V
fr(u, v) −
v∈V
fr(v, u)) =
v∈V
fr(s, v)
this follows from the fact that conservation holds for all u ∈ S other then s, but since fr(v, u) = 0 for u ∈ S and v 6 ∈ S the second sum degenerates into
∑
v∈S
fr(v, u)
giving us (^) ∑
u∈S
v∈V
fr(u, v) −
v∈S
fr(v, u))
and by regrouping we get
u∈S (
v 6 ∈S fr(u, v)) which is exactly the total flow out of^ S. So we see that |f | is actually equal to the capacity of C.
capacity from s at most degree of s times ∆ ∗ 2 since all capacities in our graph are at most ∆ ∗ 2. There will be at most log 2 (c) + 1 repetitions where c is the maximum capacity in our graph and we get a bound of O(m^2 log(c)).
It actually turns out that if we run the Ford-Fulkerson algorithm making sure to choose the least path in every iteration we can get a bound of O(m^2 n), but we shall not show that here.