• Tidak ada hasil yang ditemukan

Flows in Networks

Dalam dokumen BUKU GRAPHS & DIGRAPH PDF (Halaman 184-200)

In the first section of this chapter we considered classes of strongly connected digraphs, while in the second section we discussed the class of digraphs called tournaments, primarily concentrating on questions of connectedness. In this section, problems of connectedness will again be central as we discuss a class of digraphs possessing additional properties.

A network N is a digraph D with two distinguished vertices u and v, called the source and sink, respectively, together with a nonnegative real- valued functionc onE(D). The digraphDis called theunderlying digraph of N and the function c is called the capacity function of N. The value

172 CHAPTER 4. DIGRAPHS c(a) =c(x, y) of an arca= (x, y) ofDis called thecapacityofa. Any vertex ofN distinct fromuandvis called an intermediate vertexofN.

The sourceuofN can be thought of as the location from which material is shipped and then transported throughN, eventually reaching its destination, namely the sinkv ofN. The capacity of an arc (x, y) in N may be thought of as the maximum amount of material that can be transported fromxtoyalong (x, y) per unit time. For example, the capacity of the arc (x, y) may represent the number of seats available on a direct flight from city xto city y in some airline network, or perhapsc(x, y) is the capacity of a pipeline from city xto cityy in some oil network, or perhapsc(x, y) is the maximum weight of items that can be transported by truck from cityxto cityyin some highway network.

The problem then is to maximize theflow of material that can be transported from the sourceuto the sink v without exceeding the capacity of any arc.

A networkN can be represented by drawing the underlying digraphDofN and labeling each arc ofDwith its capacity. A network is shown in Figure 4.13.

In this network, the capacity of the arc (x, y) is then c(x, y) = 4. While in general there may be more than one source from which material originates and more than one sink providing destinations of the material, it suffices to consider a network with a single source and a single sink.

.. . .. . .. . . . . . .. .. .. .. .......

.. .. .. . . .. . .. . .. .. .. .. .

...... .............................

. .. . . .. . .. . .. . .. .. .. ........ .

........................................................................................................................... ..................................

......

..... .....

......................... .......................................................................................................................... .......................

.............................. . . . .. .

.. ..................... .. . .. . .. . .. . .. . .. . . . .. ................

........................ . .. ........................ .. . .. . .. . .. ........

......................... . .....................................

u v

x

y 4 3 5

2 2

Figure 4.13: A network

For a vertexxin a digraphD, recall that the out-neighborhoodN+(x) and the in-neighborhoodN(x) ofxare defined by

N+(x) = {y∈V(D) : (x, y)∈E(D)} and N(x) = {y∈V(D) : (y, x)∈E(D)}. Thus|N+(x)|= odxand|N(x)|= idx.

For a digraphD and a real-valued functiong defined onE(D), it is conve- nient to introduce some notation. For subsetsX andY ofV(D), define the set [X, Y] and the numberg(X, Y) by

[X, Y] ={(x, y) :x∈X, y∈Y} and

g(X, Y) = X

(x,y)[X,Y]

g(x, y),

whereg(X, Y) = 0 if [X, Y] =∅. Forx∈V(D), g+(x) = X

y∈N+(x)

g(x, y) and g(x) = X

y∈N(x)

g(y, x). (4.3) More generally, forX ⊆V(D),

g+(X) = X

x∈X

g+(x) and g(X) =X

x∈X

g(x).

A flow in a network N with underlying digraph D, source u, sink v and capacity functioncis a real-valued functionf onE(D) satisfying

0≤f(a)≤c(a) for every arcaofD (4.4) such that

f+(x) =f(x) for each intermediate vertexxofD. (4.5) If f is a function on E(D) defined by f(a) = 0 for every arc a of D, then f satisfies both (4.4) and (4.5) and so is a flow, called thezero flow.

The valuef(a) =f(x, y) of an arca= (x, y) is called theflow along the arcaand can be interpreted as the rate at which material is transported along aunder the flowf. Condition (4.4) requires that the flow alongacannot exceed the capacity ofa. Condition (4.5) is referred to as theconservation equation and states that the rate at which material is transported into an intermediate vertexxequals the rate at which material is transported out ofx.

For a flowf in a networkN, thenet flow out of a vertexxis defined by f+(x)−f(x),

while thenet flow intoxis

f(x)−f+(x).

By the conservation equation (4.5), it follows that for every intermediate vertex xofD, the net flow out ofxequals the net flow intoxand this common value is zero.

If f(a) = c(a) for an arc a in a network N, then the arca is said to be saturatedwith respect to the flowf. On the other hand, if f(a)< c(a), then the arc a is unsaturated. An example of a flow in a network is shown in Figure 4.14. The first number associated with an arc is its capacity and this is a fixed number for each arc ofN, while the second number is the flow along the arc. In general, many flows are possible for a given network. While the arc (x, t) is saturated for the flowf shown in the network in Figure 4.14 since f(x, t) = c(x, t), the arc (w, y) is unsaturated sincef(w, y)< c(w, y). In this example, the net flow out of the source u is 3 the net flow into the sinkv is also 3. As we will soon see, that these two numbers are equal is true in general.

174 CHAPTER 4. DIGRAPHS

.. .. . . .. . . . . .. . .. .. .. .

...... ...........................

. .. .. .. . . . . . . . .. .. .. . .. ......

.. .. .. . .. . . . .. . .. .. . ..

...... ............................. .

.. .. .. . . . . . . .. . .. . ..

........ ............................ .....................

. .

..................... . . ..

....................................

.. .................................... .

..............................................................................................................................................

................................

................................

.................................................................................................................................................

........

.................

......

..................

. ..................

............................... . . . .. . . ..................

. ............................. .. . . . .. .

. . . . . . .. . . . . .. . . . .

.... ......................... .. . .. . .. .. .. . .. .. . . . .. . .. .. . .. .. . .. ..

t .

z w

4,0

3,3 2,2 3,3

4,2 3,1

4,1

u v

x y 5,3

4,1 2,1

Figure 4.14: A flow in a network

Theorem 4.29 Let uandv be the source and sink, respectively, of a network N with underlying digraph D and let f be a flow defined on N. Then the net flow out ofuequals the net flow intov, that is,

f+(u)−f(u) =f(v)−f+(v).

Proof. Sincef+(V(D)) =f(V(D)), it follows that X

x∈V(D)

f+(x) = X

x∈V(D)

f(x). (4.6)

By (4.5),

f+(x) =f(x) whenx6=u, v. (4.7) By (4.6) then,

f+(u) +f+(v) =f(u) +f(v), giving the desired result.

Thevalue of a flowf in a networkN, denoted by val(f), is defined as the net flow out of the source ofN. By Theorem 4.29, val(f) is also the net flow into the sink of N. For the flowf defined on the network in Figure 4.14, we have val(f) = 3.

There are certain flows of particular and obvious interest to us. A flow in a networkN whose value is maximum among all flows that can be defined on N is called a maximum flow. Thus, a flow f defined on N is a maximum flow if val(f)≥val(f) for every flow f defined onN. For a given network, a major goal is to find a maximum flow. For the purpose of doing this, it will be convenient to introduce another concept.

LetNbe a network with underlying digraphD, sourceu, sinkvand capacity functionc. For a set X of vertices inD, letX =V(D)−X. Acut inN is a set of arcs of the form [X, X], whereu∈X andv ∈X. If K= [X, X] is a cut in N, then thecapacity ofK, denoted by cap(K), is

cap(K) =c(X, X) = X

(x,y)[X,X]

c(x, y).

For the networkN of Figure 4.14 andX ={u, x}, the cut K= [X, X] ={(u, z),(x, y),(x, t)} in N (see Figure 4.15) has capacity

cap(K) =c(u, z) +c(x, y) +c(x, t) = 4 + 4 + 3 = 11.

.. .. .. . .. . . . .. . .. . .. ........

.. .. .. .. . . . . .. . .. .. . .. ......

. .. .. .. . . . . . . . .. .. ..

....... ...........................

. .. .. .. . . . . . . .. .. .. .. . .....

t

t

......................................

....................

.............

......

.................

..................... .

z w

v 3

4

t 4

x y

u

Figure 4.15: The cut [X, X] in the networkN of Figure 4.14 forX ={u, x}

IfK is a cut in a networkN, then any path from the sourceuto the sinkv must contain at least one arc ofK. Consequently, if all arcs ofKwere removed from the underlying digraphDofN, then there would be no path fromutov.

So just as a vertex-cut in a graphGseparates some pair of vertices in Gand an edge-cut inGseparates some pair of vertices in G, a cut in the underlying digraphD of a networkN separatesuandv in a certain sense.

LetN be a network with underlying digraphD, sourceuand sinkv. For a setX of vertices ofDwithu∈X andv∈Xand a flowfdefined onN, thenet flow out ofX isf+(X)−f(X) and thenet flow intoXisf(X)−f+(X).

It then follows (see Exercise 8) that

f+(X)−f(X) =f(X, X)−f(X, X). (4.8) For the set X = {u, x, t} in the network N in Figure 4.14,f+(X) = 10 and f(X) = 7. For this network then, the net flow out ofX isf+(X)−f(X) = 10−7 = 3 = val(f). We now show that for a networkNand any cutK= [X, X] in N, the value of any flow in N is the net flow out of X and that this value never exceeds the capacity ofK.

Theorem 4.30 Let f be a flow in a network N and let K= [X, X]be a cut inN. Then

val(f) =f+(X)−f(X)≤cap(K).

Proof. LetD be the underlying digraph ofN, letuandvbe the source and sink, respectively, ofN and letc be the capacity function ofN.

176 CHAPTER 4. DIGRAPHS Sincef+(x)−f(x) = 0 for everyx∈X− {u}, it follows that

X

x∈X

(f+(x)−f(x)) =f+(u)−f(u) = val(f).

Furthermore, X

x∈X

(f+(x)−f(x)) = X

x∈X

f+(x)−X

x∈X

f(x) =f+(X)−f(X)

and so val(f) =f+(X)−f(X). Since 0≤f(a)≤c(a) for every arc aofN, it follows that

val(f) = f+(X)−f(X) =f(X, X)−f(X, X)

≤ f(X, X)≤c(X, X) = cap(K), giving the desired result.

There are in general many cuts in a networkN and each cut has a capacity.

Any cut in N whose capacity is minimum among all cuts in N is called a minimum cut. That is, a cutKin N is a minimum cut if cap(K)≤cap(K) for every cut K in N. The following two corollaries provide some important information about minimum cuts and maximum flows.

Corollary 4.31 Iff is a flow in a network N andK is a cut inN such that val(f) = cap(K), thenf is a maximum flow and K is a minimum cut inN.

Proof. Iffis a maximum flow inNandKis a minimum cut, then val(f)≤ cap(K) by Theorem 4.30. Consequently,

val(f)≤val(f)≤cap(K)≤cap(K). (4.9) Since val(f) = cap(K), it follows that there is equality throughout (4.9) and so val(f) = val(f) and cap(K) = cap(K), that is,f is a maximum flow andK is a minimum cut.

Corollary 4.32 If f is flow in a network N with capacity function c and [X, X] is a cut inN such that

f(a) =c(a)for alla∈[X, X]

and

f(a) = 0 for alla∈[X, X],

thenf is a maximum flow inN and[X, X]is a minimum cut.

Corollary 4.32 (see Exercise 9) suggests how the values of a flowf should be defined on the arcs of a minimum cut in order forf to be a maximum flow.

A networkN with sourceuand sinkvis shown in Figure 4.16 together with a flowf defined onN. As always, the first number associated with an arcais its capacityc(a) and the second number is the flowf(a). IfX={u, x, y}, then K= [X, X] is a cut inN. Sincef(a) =c(a) for alla∈[X, X] andf(a) = 0 for alla∈[X, X], it follows by Corollary 4.32 thatf is a maximum flow andK is a minimum cut. Since cap(K) = 4, the value of the maximum flowf is 4.

t

t .............................

t................................................... ............................. .....

....... .......

.......

...... ......................................................................................................................

.............................................................................................................................................................. . .. .. . .. .. .. .. .. .. . .. .. .. . .. .. .. .. .. . .. .. .. .. .. . .. .. .. . .. .. .. .. .. .. . .. .. .. . .. .. .. .. .. .. . .. .. .. .. . .. .. .. .. . .. .. .. .. .. . .. .. .. . .. .. .. .. .. .. . .. .. .. .. . .. .. .. .. .. . . ......

................................. . . . . .

..................... .. .. .. . .. ............. . .. . .. . . .. . . .. . . .....................

. .. .. . .. . . .. . . .. . . . . .. .. . .............

........

..................

.................

............................... . . . .. . .

qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq

...

......

..................

x

3,1

y z

v 4,1 1,1

2,2 3,3

4,2

u 1,0

Figure 4.16: A cutK= [X, X] in a network, whereX ={u, x, y} According to Corollary 4.31, if it should ever occur that the value of some flowf in a networkNequals the capacity of some cutKinN, thenf must be a maximum flow andKis a minimum cut. We next show that for any maximum flow f and any minimum cut K, it must occur that val(f) = cap(K). In preparation for proving this, some additional terminology is useful.

For a digraphD, anx−y semipathinD is an alternating sequence P = (x=w0, a1, w1, a2, w2, . . . , wk−1, ak, wk=y)

of distinct vertices and arcs ofDbeginning withxand ending withy such that either ai = (wi−1, wi) orai = (wi, wi−1) for eachi (1 ≤i ≤k). In this case, (wi−1, wi) is called aforward arc ofP and (wi, wi−1) is a backward arcof P. Hence, when proceeding fromxto y along the semipath P in D, we move in the direction of a forward arc onP and move opposite to the direction of a backward arc onP.

f -Augmenting Semipaths

LetN be a network with underlying digraphDand capacity functioncand on which is defined a flowf. Recall that an arcais unsaturated iff(a)< c(a).

A semipath

P= (w0, a1, w1, a2, . . . , wk−1, ak, wk) in Dis said to be f-unsaturatedif for each i(1≤i≤k),

(i) ai is unsaturated wheneverai is a forward arc and

178 CHAPTER 4. DIGRAPHS (ii) f(ai)>0 wheneverai is a backward arc.

A trivial semipath inD is vacuouslyf-unsaturated. If P is anf-unsaturated u−vsemipath inDwhereuandvare the source and sink, respectively, thenP is called anf-augmenting semipath. As we will see, given anf-augmenting semipath in the underlying digraphDof a networkN, it is possible to augment (alter) the values of the flowf on each arc ofP to obtain a new flowf whose value exceeds that off. For example, consider the flowf in the networkN in Figure 4.14, shown again in Figure 4.17. Then

P = (u,(t, u), t,(x, t), x,(x, y), y,(y, v), v) is anf-augmenting semipath.

. .. . .. . .. . . .. . .. .. .. .. ..

.... .............................

t

t

t t

t

...................... . .

.. .. ................................. ...............................................................................................................................................

....................

............ .................................................................................................................................................

........

................

...................

.. ............................ . . .. . . . .

qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq

......

................. . .. .. . .. .. .. .. .. .

.......................... .

...

.. ...............

...

....................

............................... . . .. . . .

. .. .. . .. . .. .. . .. . .. .. . .. . . .. . .. .. . .. .. . .. .. . . .. .. . .. .. .. . .. . ..

t .

z w

4,0

3,3 2,2 3,3

4,2 3,1

4,1

v x y

5,3

4,1 2,1

u

Figure 4.17: Anf-augmenting semipath in a network

Recall that the value of the flowf defined on the networkN in Figure 4.17 is 3. Letf be the function defined onE(D) by

f(a) =

f(a) + 1 ifa∈ {(x, y),(y, v)} f(a)−1 ifa∈ {(t, u),(x, t)} f(a) otherwise.

Thenfis also a flow inN and val(f) = 4. Consequently,f is not a maximum flow. In fact,f is not a maximum flow either. Thatf is not a maximum flow and thatN contains anf-augmenting semipath is not a coincidence, as Lester Randolph Ford, Jr. and Delbert Ray Fulkerson [83] showed.

Theorem 4.33 Let N be a network with underlying digraph D. A flow f in N is a maximum flow if and only if there is nof-augmenting semipath inD.

Proof. Letuandvbe the source and sink, respectively, ofNand letcbe the capacity function. Suppose first thatD contains anf-augmenting semipath

P = (u=w0, a1, w1, a2, w2, . . . , wk−1, ak, wk=v). Then, for 1≤i≤k,

(a) f(ai)< c(ai) wheneverai is a forward arc and (b) f(ai)>0 wheneverai is a backward arc.

If there is at least one forward arcai= (wi−1, wi) onP, letp1be the minimum value ofc(ai)−f(ai) over all forward arcsai. If there is at least one backward arc ai = (wi, wi−1) on P, let p2 be the minimum value of f(ai) over all such backward arcsai. If only one ofp1 andp2 is defined, then denote this number byp; otherwise, let p= min(p1, p2).

Define a functionf onE(D) by

f(a) =

f(a) +p ifais a forward arc onP f(a)−p ifais a backward arc onP

f(a) ifa /∈E(P).

Then f is also a flow. Since val(f) = val(f) +p, it follows that f is not a maximum flow.

We now turn to the converse. Assume that there is nof-augmenting semi- path in D. Let X be the set of all verticesx in D for which there exists an f-unsaturatedu−xsemipath. Thenu∈X and, by assumption,v /∈X. Thus K= [X, X] is a cut inN.

Let (y, z) be an arc in K. Sincey∈X, there exists anf-unsaturatedu−y semipath P in D. Since z ∈ X, there is no f-unsaturated u−z semipath in D, which implies that f(y, z) = c(y, z). Similarly, if (w, x) ∈ [X, X], then f(w, x) = 0. Since K = [X, X] is a cut such that f(a) = c(a) for every arc a∈[X, X] andf(a) = 0 for every arc a∈[X, X], it follows by Corollary 4.32 thatf is a maximum flow.

The Max-Flow Min-Cut Theorem

With the aid of the preceding theorem, Ford and Fulkerson [83] proved a famous result in 1956 that is known as theMax-Flow Min-Cut Theorem. Inde- pendently, and also in 1956, Peter Elias, Amiel Feinstein and Claude Elwood Shannon [68] discovered and proved the very same result.

Theorem 4.34 (The Max-Flow Min-Cut Theorem) In any network, the value of a maximum flow equals the capacity of a minimum cut.

Proof. Letf be a maximum flow in a networkN having capacity functionc. By Theorem 4.33, there is nof-augmenting semipath in the underlying digraph D of N. By the proof of Theorem 4.33, since D contains no f-augmenting semipath, there is a minimum cut K= [X, X] such that

f(a) =

c(a) ifa∈K 0 ifa∈[X, X].

180 CHAPTER 4. DIGRAPHS Therefore, by (4.8),

val(f) = f+(X)−f(X) =f(X, X)−f(X, X)

= c(X, X)−0 = cap(K), as desired.

The proof of Theorem 4.33 provides the basis of an algorithm, also due to Ford and Fulkerson [84], for finding a maximum flow and a minimum cut in a network. A refinement of this algorithm, due to the Russian scientist Efim A. Dinic [58], was first published in 1970 and independently by Jack Edmonds and Richard M. Karp [65] in 1972, although they discovered this earlier. The Edmonds-Karp algorithm, which we describe next, searches for an f-augmenting semipath in a network with a given flow f. This is an efficient algorithm, having complexity O(nm2), where the underlying digraph of the network has ordernand sizem.

Letuandvbe the source and sink of a networkNwith underlying digraphD and letf be a given flow inN (perheps the zero flow). The algorithm proceeds by constructing a sequence of labelings of the vertices ofD. A vertexwinDis assigned a label only if there is anf-unsaturatedu−wsemipathP inD. The label assigned towis an ordered pair. Ifxis the vertex immediately preceding w onP, then the first coordinate of the label is either x+ or x−, according to whether the arc immediately preceding w is (x, w) or (w, x). The second coordinate of the label is a positive number that reflects the potential change inf alongP as we will soon describe. As we proceed through the algorithm, a list of labeled vertices is created. At a certain stage of the algorithm, a list L consisting of some labeled vertices ofDis formed. At some point, the first vertex on L is examined (scanned) and removed from L to determine whether this vertex is adjacent to certain unlabeled vertices possessing a particular property in which case all such vertices are then labeled and added toL. If the sinkvis labeled, then a new flow of greater value can be obtained. This process is then repeated. If, however, the sinkv is not labeled, thenf is a maximum flow. In this case, the labels can be used to find a minimum cut.

Throughout the course of the algorithm, each vertex ofD is considered to be in one of the following three states:

(1) unlabeled, (2) labeled and unscanned, (3) labeled and scanned.

Prior to the implementation of the algorithm, all vertices are unlabeled. Once a vertex is assigned a label, it is placed at the end of a list L consisting of the labeled and unscanned vertices. The vertices ofL are scanned on a first- labeled first-scanned basis, which will guarantee the selection of a shortest f- augmenting semipath. The Edmonds-Karp algorithm is now stated.

Algorithm 4.35 Given a network N with underlying digraph D, source u, sinkv and capacity functionc.

1. Letf be a flow onD and label each arc ofD with the value of f. 2. Label the sourceuwith the ordered pair (−,∞) and adduto the listL

of labeled and unscanned vertices.

3. IfLis empty, then stop. Otherwise, scan and remove the first element of L, sayx, having the label (z+, ǫ(x)) or (z−, ǫ(x)).

3.1 Assign to each unlabeled vertexy for which (x, y)∈E(D) andf(x, y)< c(x, y) the label (x+, ǫ(y)), where

ǫ(y) = min{ǫ(x), c(x, y)−f(x, y)} and addy to the end of L.

3.2 Assign to each unlabeled vertexy for which (y, x)∈E(D) andf(y, x)>0 the label (x−, ǫ(y)), where

ǫ(y) = min{ǫ(x), f(y, x)} and addy to the end of L.

4. Ifv has been labeled, go to Step 5; otherwise return to Step 3.

5. The labels describe an f-augmenting semipath

(u=w0, a1, w1, a2, w2, . . . , wk−1, ak, wk=v) where, for 1≤i≤k,wi is labeled

(wi−1+, ǫ(wi)) ifai= (wi−1, wi) is a forward arc or wi is labeled

(wi−1−, ǫ(wi)) ifai= (wi, wi−1) is a backward arc.

In the first case, replace f(wi−1, wi) byf(wi−1, wi) +ǫ(v); while in the second case, replacef(wi, wi−1) byf(wi, wi−1)−ǫ(v).

6. Discard all labels, remove all vertices fromL and return to Step 2.

If the capacity of every arc in a network is an integer, then the value of an integer-valued flow increases by 1 or more with each iteration of Algorithm 4.35 and the algorithm terminates after finitely many iterations. This is also the case when the capacity of every arc is a rational number and a given flow is rational- valued. Since networks commonly encountered in discrete mathematics have integer capacities, it is integer-valued flows that we seek. For the remainder of our discussion on flows in networks, we assume that the capacities and flows in networks are integer-valued.

182 CHAPTER 4. DIGRAPHS Theorem 4.36 Algorithm4.35terminates with a maximum flowf inN. Fur- thermore, if X is the set of labeled vertices upon termination, then [X, X]is a minimum cut.

Proof. By Theorem 4.33, each time that Step 5 is completed, a new flowf having a larger value is constructed. If, in Step 3, the list L is empty, then there is nof-augmenting semipath and so, by Theorem 4.33,f is a maximum flow and [X, X] is a minimum cut. This process must terminate since for every flowf in N,

val(f)≤c(u, V(D)) and so Step 5 can be repeated at mostc(u, V(D)) times.

We now illustrate Algorithm 4.35 by applying it to the network shown in Figure 4.18. It is not difficult to find the flow f shown in Figure 4.18, which we take as the initial flow. As always, each arcais labeled with the pairc(a), f(a), wherec(a) is the capacity ofaand f(a) is the flow alonga.

.. . .. . .. . . . . .. . .. .. . ..

...... .............................

.. .. .. .. . . . . .. . .. .. . ..

....... ............................. .

.. .. .. . . . . . . .. .. ..

.......... ............................. ............................ ............................ ......................

.

...................... . ...............................................................................................................................................

.... .................

............

...............................

.................................................................................................................................................

......

..................

...................

. ............................. .. . .. . . . ...........

........ ...........

.......

.................................................................................................................................... ........

....... .....................

.

.................................................................................................................................. ......

........................ .....................

............................... . . .. . ..

.......

................. . .. . .. .. . .. .. . .. . .. .. . . . .. .. .. .. . .. . . .. . . . ......

...................... .

..................... .. ..................

............................... . .. . . ..

. .. . .. . .. .. . .. . .. . .. .. . .. . . .. . .. . . . .. . .. . . . ...........

4,2 v r y

s t

2,2

3,1

3,3 3,1

3,0 7,4 1,1

z w

5,2

4,1 N :

3,2

3,3 u

Figure 4.18: A flowf in a network

Since an initial flow has been given to the network N, Step 1 of Algo- rithm 4.35 has been completed and we have the situation shown in Figure 4.18.

Initially, the sourceuis assigned the label (−,∞) and the listLof labeled but unscanned vertices now consists of the vertex u only. Thus Step 2 of Algo- rithm 4.35 is now completed.

We now move on to Step 3. Since L is not empty, we do not stop. We now scan and remove the first element ofL from this list. In this case, onlyu belongs toL, souis now removed from L. Thus L is now empty. We search for all vertices x of N such that either (u, x) ∈ E(D) and f(u, x) < c(u, x) or (x, u) ∈ E(D) and f(x, u) > 0. There are two vertices with one of these properties, namely r and s. We consider r first. Since (u, r) ∈ E(D), the first coordinate of the label ofr isu+. Sincec(u, r)−f(u, r) = 3, the second coordinate of the label ofris 3 and soǫ(r) = 3. That is,ris assigned the label (u+,3). The vertexr is then placed at the end of L. SinceL was previously empty, we now haveL:r. We now turn to the vertexs. Because (s, u)∈E(D), the first coordinate of the label of s is u−. Because f(s, u) = 2, the second coordinate of the label of sis 2 and so ǫ(s) = 2. Thus sis assigned the label

Dalam dokumen BUKU GRAPHS & DIGRAPH PDF (Halaman 184-200)