• Aucun résultat trouvé

The Theorems of Ford and Fulkerson

Dans le document Algorithms and Computation in Mathematics • (Page 175-182)

The Greedy Algorithm

Exercise 5.2.17 Show that the set C of circuits of a matroid (E, S) actu- actu-ally satisfies the following stronger version of the circuit axiom (2) in

6.1 The Theorems of Ford and Fulkerson

In this chapter, we study networks of the following special kind. Let G= (V, E) be a digraph, and let c:E→R+0 be a mapping; the value c(e) will be called thecapacity of the edgee. Moreover, letsandtbe two special vertices ofGsuch that t is accessible froms.1Then N= (G, c, s, t) is called aflow network withsource sandsink t. Anadmissible flow or, for short, a flow onN is a mappingf:E→R+0 satisfying the following two conditions:

(F1) 0≤f(e)≤c(e) for each edge e;

(F2)

e+=vf(e) =

e=vf(e) for each vertex v=s, t, where e and e+ denote the start and end vertex ofe, respectively.

Thus thefeasibility condition (F1) requires that each edge carries a nonneg-ative amount of flow which may not exceed the capacity of the edge, and

1Some authors require in additiondin(s) =dout(t) = 0. We do not need this condition here;

it would also be inconvenient for our investigation of symmetric networks and the network synthesis problem in Chap. 12.

D. Jungnickel,Graphs, Networks and Algorithms, Algorithms and Computation in Mathematics 5,

DOI10.1007/978-3-642-32278-5 6,©Springer-Verlag Berlin Heidelberg 2013

163

theflow conservation condition (F2) means that flows are preserved: at each vertex, except for the source and the sink, the amount that flows in also flows out. It is intuitively clear that the total flow coming out ofs should be the same as the total flow going intot; let us provide a formal proof.

Lemma 6.1.1 Let N= (G, c, s, t)be a flow network with flow f. Then

Now the assertion follows immediately from (F2).

The quantity in equation (6.1) is called the value of f; it is denoted by w(f). A flow f is said to be maximal if w(f)≥w(f) holds for every flowf onN. The main problem studied in the theory of flows is the deter-mination of a maximal flow in a given network. Note that, a priori, it is not entirely obvious that maximal flows always exist; however, we will soon see that this is indeed the case.

Let us first establish an upper bound for the value of an arbitrary flow.

We need some definitions. LetN= (G, c, s, t) be a flow network. Acut of N

thus it is just the sum of the capacities of all those edgesein the corresponding cocycleE(S, T) which are oriented fromS toT. The cut (S, T) is said to be minimal ifc(S, T)≤c(S, T) holds for every cut (S, T). An edgeeis called saturated iff(e) =c(e), andvoid iff(e) = 0.

The following lemma shows that the capacity of a minimal cut gives the desired upper bound on the value of a flow; moreover, we can also characterize the case of equality in this bound.

6.1 The Theorems of Ford and Fulkerson 165

In particular, w(f)≤c(S, T); equality holds if and only if each edge e with e∈S ande+∈T is saturated,whereas each edgeewith e∈T ande+∈S is void.

Proof Summing equation (F2) over allv∈S gives w(f) =

Note that the first and third terms cancel. Moreover,f(e)≤c(e) for all edges e with e∈S and e+∈T, and f(e)≥0 for all edges e with e+∈S and e∈T. This implies the desired inequality and also the assertion on the case

of equality.

The main result of this section states that the maximal value of a flow always equals the minimal capacity of a cut. But first we characterize the maximal flows. We need a further definition. Letf be a flow in the network N= (G, c, s, t). A pathW from sto t is called anaugmenting path with re-spect tof iff(e)< c(e) holds for every forward edgee∈W, whereasf(e)>0 for every backward edgee∈W. The following three fundamental theorems are due to Ford and Fulkerson [ForFu56].

Theorem 6.1.3 (Augmenting path theorem) A flow f on a flow network N= (G, c, s, t)is maximal if and only if there are no augmenting paths with respect to f.

Proof First letf be a maximal flow. Suppose there is an augmenting pathW. Letdbe the minimum of all valuesc(e)−f(e) (taken over all forward edgese inW) and all valuesf(e) (taken over the backward edges inW). Thend >0,

Conversely, suppose there are no augmenting paths inN with respect tof. LetS be the set of all verticesv such that there exists an augmenting path fromstov (includingsitself), and putT=V \S. By hypothesis, (S, T) is a cut ofN. Note that each edgee=uvwithe=u∈S ande+=v∈T has to be saturated: otherwise, it could be appended to an augmenting path from sto uto reach the pointv∈T, a contradiction. Similarly, each edge ewith e∈T ande+∈S has to be void. Then Lemma 6.1.2gives w(f) =c(S, T),

so thatf is maximal.

Let us note the following useful characterization of maximal flows con-tained in the preceding proof:

Corollary 6.1.4 Let f be a flow on a flow network N= (G, c, s, t), denote by Sf the set of all vertices accessible from s on an augmenting path with respect to f, and put Tf=V \Sf. Thenf is a maximal flow if and only if t∈Tf.In this case, (Sf, Tf) is a minimal cut: w(f) =c(Sf, Tf).

Theorem 6.1.5(Integral flow theorem) LetN= (G, c, s, t)be a flow network where all capacitiesc(e)are integers.Then there is a maximal flow onN such that all valuesf(e)are integral.

Proof By settingf0(e) = 0 for alle, we obtain an integral flowf0 onN with value 0. If this trivial flow is not maximal, then there exists an augmenting path with respect to f0. In that case the number d appearing in the proof of Theorem6.1.3is a positive integer, and we can construct an integral flow f1 of value d as in the proof of Theorem 6.1.3. We continue in the same manner. As the value of the flow is increased in each step by a positive integer and as the capacity of any cut is an upper bound on the value of the flow (by Lemma 6.1.2), after a finite number of steps we reach an integral flowf for which no augmenting path exists. By Theorem6.1.3, this flowf is

maximal.

Theorem 6.1.6(Max-flow min-cut theorem) The maximal value of a flow on a flow networkN is equal to the minimal capacity of a cut for N. Proof If all capacities are integers, the assertion follows from Theorem6.1.5 and Corollary6.1.4. The case where all capacities are rational can be reduced to the integral case by multiplying all numbers by their common denominator.

Then real-valued capacities may be treated using a continuity argument, since the set of flows is a compact subset of R|E| and since w(f) is a continuous function off. A different, constructive proof for the real case is provided by the theorem of Edmonds and Karp [EdmKa72], which we will treat in the

next section.

Theorem6.1.6was obtained in [ForFu56] and, independently, in [EliFS56].

In practice, real capacities do not occur, as a computer can only represent

6.1 The Theorems of Ford and Fulkerson 167

(a finite number of) rational numbers anyway. From now on, we mostly re-strict ourselves to integral flows. Sometimes we also allow networks on di-rected multigraphs; this is not really more general, because parallel edges can be replaced by a single edge whose capacity is the sum of the corresponding capacities of the parallel edges.

The remainder of this chapter deals with several algorithms for finding a maximal flow. The proof of Theorem 6.1.5 suggests the following rough outline of such an algorithm:

(1) f(e)0 for all edgese;

(2) while there exists an augmenting path with respect tof do (3) letW= (e1, . . . , ek) be an augmenting path fromsto t;

Of course, we still have to specify a technique for finding augmenting paths.

We will apply a modified breadth first search (BFS), where edges may be used regardless of their orientation as long as they satisfy the necessary condition f(e)< c(e) or f(e)>0. Note that we not only have to decide whether t is accessible fromsby an augmenting path, but we also need to find the value for d and change the values f(e) accordingly. In view of these additional requirements, it makes sense to use a labelling technique; moreover, this will also allow us to find a minimal cut easily.

Algorithm 6.1.7 (Labelling algorithm of Ford and Fulkerson) Let N = (G, c, s, t) be a flow network.

Procedure FORDFULK(N;f, S, T) (1) fore∈E dof(e)0 od (2) labelswith (−,∞);

(3) forv∈V dou(v)←false;d(v)← ∞od (4) repeat

(5) choose a vertex v which is labelled and satisfiesu(v) = false;

(6) for e∈ {e∈E:e=v} do

(16) thenletdbe the last component of the label oft;

(17) w←t;

(18) while w=sdo

(19) find the first componentv of the label ofw;

(20) ifthe second component of the label of wis + (21) thensetf(e)←f(e) +dfore=vw

(22) else setf(e)←f(e)−dfore=wv

(23)

(24) w←v

(25) od

(26) delete all labels except for the label ofs;

(27) forv∈V dod(v)← ∞; u(v)←falseod

(28)

(29) untilu(v) = true for all verticesv which are labelled;

(30) letS be the set of vertices which are labelled and putT←V \S Using the proofs we gave for Theorems6.1.3and 6.1.5, we immediately get the following theorem due to Ford and Fulkerson [ForFu57].

Theorem 6.1.8 Let N be a network whose capacity function c takes only integral(or rational)values.Then Algorithm6.1.7determines a maximal flow f and a minimal cut(S, T), so thatw(f) =c(S, T) holds.

Algorithm6.1.7may fail to terminate for irrational capacities, if the vertex vin step (5) is chosen in an unfortunate way. An example for this phenomenon (on a network with 10 vertices and 48 edges) can be found in [ForFu62], p. 21, where the algorithm actually converges, but to a value which is only 1/4 of the maximal possible flow value. The smallest network for which the algorithm fails to terminate has only 6 vertices and 8 edges; see [Zwi95].

Moreover, while Algorithm6.1.7terminates in the important special case of integer capacities, it is unfortunately not polynomial: the number of aug-mentations does not only depend on|V| and|E|, but also on the capacities.

For example, if we use the paths

s a b e f t and

s d e b c t

alternately as augmenting paths for the network in Fig.6.1(which the algo-rithm will do if vertexv in step (5) is chosen suitably), the value of the flow will only be increased by 1 in each step, so that we need 2n iterations. Of course, this can be avoided by choosing the paths appropriately; with

s a b c t and

s d e f t,

6.1 The Theorems of Ford and Fulkerson 169 Fig. 6.1 A flow network

we need only two iterations. In the next section, we will see that the aug-menting paths can always be chosen efficiently. Then we shall also apply the resulting algorithm to an example and show the computations in detail. We close this section with some exercises.

Exercise 6.1.9 Let N= (G, c, s, t) be a flow network for which the vertex capacities are likewise restricted: there is a further mappingd:V R+0, and the flowsf have to satisfy the additional restriction

(F3)

e+=vf(e)≤d(v) forv=s, t.

For instance, we might consider an irrigation network where the vertices are pumping stations with limited capacity. Reduce this problem to a problem for an appropriate ordinary flow network and generalize Theorem 6.1.6 to this situation; see [ForFu62],§1.11.

Exercise 6.1.10 How can the case of several sources and several sinks be treated?

Exercise 6.1.11 LetN= (G, c, s, t) be a flow network, and assume that N admits flows of value= 0. Show that there exists at least one edge e in N whose removal decreases the value of a maximal flow onN. An edgeeis called most vital if the removal of e decreases the maximal flow value as much as possible. Is an edge of maximal capacity in a minimal cut necessarily most vital?

Exercise 6.1.12 By Theorem 6.1.5, a flow network with integer capacities always admits an integral maximal flow. Is it true that every maximal flow has to be integral?

Exercise 6.1.13 Let f be a flow in a flow network N. Thesupport off is suppf ={e∈E:f(e)= 0}. A flowf is calledelementary if its support is a path. The proof of Theorem 6.1.6and the algorithm of Ford and Fulkerson show that there exists a maximal flow which is the sum of elementary flows.

Can every maximal flow be represented by such a sum?

Exercise 6.1.14 Modify the process of labelling the vertices in Algo-rithm6.1.7in such a way that the augmenting path chosen always has

max-imal possible capacity (so that the value of the flow is always increased as much as possible).

Hint: Use an appropriate variation of the algorithm of Dijkstra.

Exercise 6.1.15 Let N = (G, c, s, t) be a flow network, and assume that both (S, T) and (S, T) are minimal cuts for N. Show that (S∩S, T∪T) and (S∪S, T∩T) are likewise minimal cuts forN.

Exercise 6.1.16 Letf be any maximal flow. Show that the set Sf defined in Corollary6.1.4is the intersection over all sets S for which (S, V \S) is a minimal cut. In particular,Sf does not depend on the choice of the maximal flowf.

Dans le document Algorithms and Computation in Mathematics • (Page 175-182)