4 HD28 M4 1 . lAUG IMPROVED TIME BOUNDS FOR THE MAXIMUM FLOW PROBLEM R. K. J. Ahuja B. Orlin R. E. Tarjan Sloan W.P. No. 1966-87 December 1987 Revised: June 1988 MASSACHUSETTS INSTITUTE OF TECHNOLOGY 50 MEMORIAL DRIVE CAMBRIDGE, MASSACHUSETTS 02139 23 1986 '*^ IMPROVED TIME BOUNDS FOR THE MAXIMUM FLOW PROBLEM R. K. J. B. Ahuja OrUn R. E. Tarjan Sloan W.P. No. 1966-87 December 1987 Revised: June 1988 Improved Time Bounds for the Ravindra K Maximum Flow Problem Ahuja James B. Orlin ' Robert E. Tarjan September. 1987 Revised June. 1988 ABSTRACT Recently, Goldberg proposed a The approach flow problem. time on n-vertex networks. Sleator and Tarjan yields a new approach lo the maximum yields a ver>' simple algorithm nmning netv.ork in 0{n^) Incorporation of the dynamic tree data structure of more complicated algorithm with a running time of 0{rvn log {n^ Im)) on m-arc networks. Ahuja and Orlin developed a variant of Goldberg's algorithm that uses scaling and runs in works with integer arc capacities bounded by U. ble improvements to the ning lime of 0(,nm Then we 0(,rm + n' logL') time on net- In this paper we explore possi- Ahuja-Oriin algorithm. First we obtain an improved run- n^ logL'/log logL') by using a nonconsiant scaling -t- obtain an even better bound of 0{run -t- n^Qogt/)'^) by combining the Ahuja-Orlin algorithm with the wave algorithm of Tarjan. Fmally. the use of dynamic 0{rvn log( — Gogt/)' factor. we show that trees in the laner algorithm reduces the running time to ' + 2)). This result shows that the combined use of three tn different techniques results in speed not obtained by using any of the techniques alone. MIT, Ciinbndge, MA 02139 Retearch ptrtUDy fupponed b> i Prendenti«] Yoimg InNSF. Cooiria S-JflSP ECS. ind grinu from .ViiJog DeMcts. Kpfit Compuitr Inc. «nd Slcxn School at .Min»ganent, vesuguor Fello»ihip from Uie f^ime Computer. On Itive from Indian Inrntuie of Technology. Kjnpur. Indu. Dqx Reie*n* of Computer Saence. Pnncaon Univemry. Pnnceuxi. p«ru*l]y luppone^l by NSF Gr»nt DCR-860596; md M 085*4 ind ATAT Office of Ntvxl Bell Ubs. Murray Hill, N7 0^974. Rettin* Coniiia N00014-87-K-O467. Improved Time Bounds for the Maximum Flow Problem Ravindra K. Ahuja James BO ' rlin Robert E. Tarjan ' September, 1987 Revised June, 1988 1. Introduction We We formulate the problem as follows. Let arc set E. The graph and a sink t, G symmetric, tices, the number of bounds, G iflow network is G = (V.E) if it flow problem [5,6,13,15,20]. be a directed graph with vertex set we assume (v.w) e i.e. arcs, £ t/ (w.v) e E. maximum and the m^n and iff ^ 4. We denote by n, m, and arc capacity, respectively. Bounds containing U and U We assume number of the For ease ver- in stating time are subject to the assumption that all All logarithms in the paper are base arc capacities are integral. V has two distinct distinguished vertices, a source s and a non-negative real-valued capacity «(v,>v) on each arc (v,^) € E. is that maximum network consider algorithms for the classical two unless an explicit base is given. A flow f on G a netwoiit is a real-valued function /on the arcs satisfying the following con- straints: f(v,w) < u(v,w) for f(y,w) S = -f(w,v) /(v.**') = all (v.w) e for all (v.w) for all w E (capacity constraint), e E (antisymmetry (1) constraint), e V-[s.t] (conservation (2) constraint). (3) (v.w)e£ SloBi School of Msugeniail, M J.T., Cunbndge. MA 02139. veniguor FcDowihip from the NSF, Conna Re»e«rch piitudly lupponwl by a PreiidentUJ Young In- 8451517 ECS. »nd gnuiu frcnn Analog Devicei. Apple Computer Inc.. ind Prime Compuicr. On ^ leave from Indian Intticule of Technology, Kanpui, India. Dept of Compuler Saence. Pnnceloti Umveniiy, Pnnccum, NJ 08544 Bid Researx* pamally lupponed by NSF Grant OCR -8605962 AT&T BeU Labi, Murray Hill, NI 07974. and Office of Naval Reaearch Contract N00014-87-K-O467. The value /I of a flow /is I the nel flow into the sink: 1/1= I /(v./). (v.Oe£ A maximum flov.maximum flow of maximum value. The maximum assimie that all arc capacities are finite. path of infinite-capacity edges from j to sum of the finite capacities, r exists, then some If each problem is that of finding a no arc capacities are infinite but infinite capacity can be replaced by the D without affecting the problem. The maximum flow problem has a long and rich history, and a series of faster and faster algorithms for the problem has been developed. (See [10] for a brief survey.) The previously knowTi algorithms are that of Goldberg and Tarjan [8,10], with a running time of fastest 0{,nm log (n^/m)), and that of Ahuja and Orlin Both of these algorithms we flov,' flow in a given network. We Remark. is a [1], with a running time of 0{,nm are refinements of a generic method proposed by Goldberg m prefknv algorithm. For networks with shall call the + n} = [8], fi(n^), the Goldberg-Tarjan logt/). which bound is O(n^), which matches the bound of several eariier algorithms [12,14,16,21]. For networks with m = 0(n^"^) the for bound of the m 0, the Goldberg-Tarjan bound earlier Sleator-Tarjan algorithm [17,18]. U = 0(n*) namely unless some constant e > for some constant = 0(n)orm = k, the Ahuja-Oriin Under 0(nm \ogn), the similarity bound beats which matches assumption the Goldberg-Tarjan The former uses a sophisticated data structure, the and Taijan [18,19,20], whereas the latter their We dynamic uses scaling. In this paper we tree structure of Sleator explore improvements in -»- 0(nm + n^ logt//log logt/). In Sec- describe an even faster variant, which uses a coristani scaling factor but combines the scaling idea with the 0(nm 3, a version of the Ahuja-Oriin algorithm that uses a stack-based vertex selection rule and a nonconstanl scaling factor to obtain a time bound of we dynamic begin in Section 2 by reviewing the generic preflow algorithm [8,9,10]. In Section we develop tion 4, bound speed from two different the Ahuja-Oriin algorithm obtainable by incorporating other ideas, including the use of trees. [7], Cl{n^). The Goldberg-Tarjan and Ahuja-Orlin algorithms obtain techniques. is fi^ wave algorithm of Tarjan QogU)^'^). In Section 5 obtaining a running time of 0(nm [21]. we add dynamic This algorithm has a running time of trees to the — Oogt/)"^ +2). The method of Seaion 4, thereby results in Sections 3-5 rely on the assumption that pointer manipulations and arithmetic operations on integers of magnitude U take log( m -3- 0(1) time. In Section 6 we consider the namely that arithmetic with some 2. final on our time bounds of a weaker assumption, effect We on integers of magnitude n takes 0(1) time. conclude in Section 7 remarks. The Preflow Algorithm In contrast to the classical augmenting path flow along an entire path from ; to f method of Ford and Fulkerson a time. The key concept underlying the algorithm [12]. A moves flow along once, the preflow method at that is For any vertex w. let the flow excess of w be e(w) = "^ (v,w)€ constraint and a relaxa- (1), (2), The /(v.w). required E the following: is e(w) ^ We a single arc at of a preflow, introduced by Karzanov preflow /is a real-valued function on the arcs satisfying constraints tion of (3). which moves [6], call a vertex v active if for all v^ / and w € V-{s} (nonnegativity constraint). e(y) > 0. Observe arc (v,>v) (4) thai the nonnegativity constraint implies thatc(5)<0. The uj{v,w) = u(v,w)-f(v,w). An an of capacity residual arc is saturated if with ujiv,w) respect = > / is (The 0.) moves flow from aaive a preflow and preflow a and unsaturated otherwise. capacity constraint implies that any unsaturated arc (v.w) has u/v.w) The preflow algorithm maintains to vertices through unsaturated arcs toward the sink, along paths estimated to contain as few arcs as possible. Excess flow that cannot be moved to the sink is returned to the source, also along estimated shortest paths. Eventually the preflow As an to the every unsaturated arc d(v) ^ min [df{v,s) w (v,w) a flow, which is a maximum + nonnegative integers such that dis) (v.h'). A n,dj{v,t)], = unsaturated and d{v) n, proof by induction shows where dj{v,w) is the = d(w) + 1. d{t) that, = 0, is /. We for any valid call a function and d(v) < d(w) + minimum number of arcs on consisting of arcs unsaturated with respect to the flow is flow. estimate of path lengths, the algorithm uses a valid labeling, which from the vertices to becomes 1 d for labeling d, a path from v an arc (v,>v) eligible if .4- The algorilhm begins with an preflow/and valid labeling J defined initial u{v,w) if /(V.H')=' -u(w,v) if V The algorithm = m\n [df(v,s) consists of repeating the following =s, w = s, if V d(v) as follows: * + J and w ^s. n,djiv,t)]. two steps, in any order, until no vertex is ac- tive: Push (y,w). Applicability: Vertex v is active and arc (v,w) Action: Increase /(v.w) by min is [e(v),uj{v,w)]. eligible. The push is saturating if (v.w) is saturated after the push and nonsaturating otherwise. Relabel (v). Applicability: Vertex v is Action: Replace d(v) by When active and no arc (y,w) min {d(w) +1 the algorithm terminates, /is a I (v.w) maximum is is eligible. unsaturated). flow. Goldberg arxl Tarjan derived the fol- lowing bounds on the number of steps required by the algorithm: Lemma The 2.1 [10]. total Lemma Relabeling a vertex v number of relabelings is No vertex label exceeds 2n-l. saturating pushes and at most 0{n^m) nonsaturating strictly increases d{v). 0(,n^). 2.2 [10]. There are at most 0{nm) pushes. Efficient implementations of the and relabeling steps to perform. vertex, construct a (fixed) first on the list above algorithm require a mechanism for selecting pushing Goldberg arxl Tarjan proposed the following method. For each A{y) of the arcs out of Lst, as the current arc out of v. To v. Designate one of these arcs, initially the execute the algorithm, repeat the following step -5- no until there PushJRelabel active vertices: (v). Applicability: Vertex v is active. Action: If the current arc (v.h-) of v is not the last arc on i4(v), is make wise, perform relabel (v) and With this eligible, perform push(y,w). Othenvise. if (v.w) the next arc after (v.w) the current one. Other- make the first arc on /4(v) the current one. implementation, the algorithm runs in 0(jvn) time plus 0{\) time per nonsaturat- ing push. This gives an 0{,n}m) time bound for any order of selecting vertices for push/relabel Making steps. the algorithm faster requires reducing the time spent number of such pushes can be reduced by Goldberg and Tarjan showed that FIFO on rwnsaturating pushes. The selecting vertices for push/relabel steps carefully. selection (first active, first selected) reduces the of rxjnsaturating pushes to 0{n}). Cheriyan and Maheshwari [3] showed 0{n}m^'^). Ahuja and Orlin proposed a to that highest label selec- number of nonsaturating tion (always pushing flow from a vertex uiih highest label) reduces the pushes number which we discuss third selection rule, in the next section. 3. The Scaling Algotithm The behind the Ahuja-Oriin algorithm, henceforth called the scaling algo- intuitive idea rithm, is to move large amounts of flow when possible. The same idea capacity augmenting path method of Gabow [7]. One way Edmonds and Karp [4] excess Making For this this to apply this idea to the preflow algorithm its the algorithm proceeds, k remains fixed, but vertex v. is The to always push flow from a effect of this is to reduce the method precise requires specifying when an excess v is said to have large excess if power of k such maximum at a rapid rate. purpose the scaling algorithm uses an excess bound A vertex behind the and the capacity scaling algorithm of vertex of large excess to a vertex of small excess, or to the sink. maximum is that AS I/. A arxl is when large and an integer scaling factor A periodically decreases. Initially, the invariant that e{v) SA A is for every active Push (v.w). active and arc (v.w) Action: If w *r, increase /(v.w) by increase /(v.w) by min min is eligible. (f(v).«/(v,H'), A-*(h')). Otherwise [e{v),Uf{v,w)). As the smallest This requires changing the pushing step to the following. is kt2. excess exceeds A/k and small excess otherwise. The algorithm maintains Applicability: Vertex v small. (w = r), consists of a The algorithm A stant. number of scaling phases, during each of which A remains con- phase consists of repeating push/relabel steps, using the following selection active vertex has large excess, and then replacing no A by rule, until The algorithm terminates when A/it. there are no active vertices. Large excess, smallest label excess; among such choose one of smallest vertices, t/+ after [ log* mainuins A< phases, ij integrality of vertex excesses. number of nonsaturating pushes. the total tion for our Lemma first 3.1 The + < <1> and labeling ing step decreases w <1> most 2n^ I initial [ log* Thus When A U+ U + 2} in The . 1 total Thus O call it provides motiva- the algorithm scaling is the potential of the current < d(v) < 2n and push A is A <I>. nonsaturating push- from a vertex v with excess more than A/k w= or r. The value of A can increase only <I> the total increase in <I> by is at at most 2n^. at most the This happens over the entire algorithm number of nonsaturating pushes This <1> due to relabelings, over the entire algorithm, increases by a factor of )!:, to C). for every active vertex v, relabeling of a vertex v increases the total increase in <I> We Every pushing step decreases changes. changes. times. \j < e(v)/A < value of <I> and the total increase in Choosing \} a flow, since the algorithm repeat the analysis here, since = d(v) -1, and e(w) ^ A/k when A increases. logi We at least l/k. since the with d(w) most 2n^. is at /is U+ acbve the algorithm. by during a relabeling or amount ^(v) that log* [ Ahuja and Orlin derived a bound of 0(kn^ log* U) on e(v)rf(v)/A. J^ Since d. < 2«^ throughout to a vertex which implies most after at l)). V / 1, number of nonsaturating pushes total Consider the function <!)= preflow label. modification of the algorithm. [1]. OC/k/j^OogilZ Proof. a push/relabel step to an active vertex v of large edge capacities are integers, the algorithm terminates If the phases: Apply selection: is at most 2kn^ [ is at most most k times the sum of log^ t/ + 3j . at the D 0(nm -«- n^ log U) for the scaling algorithm, given an efficient implementation of the vertex selection rule. One way to all implement /t to be a constant independent of n gives a total the rule is to maintain an array of sets indexed time bound of by vertex label, each set containing large excess vertices with the corresponding label, and to maintain a pointer to the set of smallest index. Remark. The bound The total time needed to maintain for the scaling algorithm this structure is can be improved slightly 0(nm + n^ if it is nonempty log U). measured in terms -7- pushes can be reduced to improvement is O A^ phase y - changes to phase ; 1 is O is at (n^ logt/*). <I> is at due to is as follows. most nU* O (nm + n} log The algorithm maintains Let phase j be the . The ). to bound on nonsaturating to phase such that first and including the change from total increase in <I> due to later phase D time can be improved by reducing the number of nonsaturating pushes. The proof of bounds the number of nonsaturating pushes by estimating the that there is an This the invariant Having described the scaling algorithm, we consider the question of whether Observe (/*). derived for their capacity-scaling phase changes up most n 2) 2n/2'~* = 0(n the bound the overall time Edmonds and Karp The argument the total iixrcase in Then u(s,v)/n. J^ U') and excess on active vertices Then {/*. (n^ log analogous to the bound transportation algorithm [4]. that the total (/*=4+ Let of a different parameter. imbalance changes, whereas only O(n^) in this estimate: due is 0{n^ to relabelings. log* its running Lemma 3.1 total increase in the potential U) of Our plan is the increase to improve is due to <I>. phase this estimate by decreasing the contribution of the phase changes, at the cost of increasing the contribution of the relabelings. We We make Making this plan work requires changing the algorithm. use a nonconstant scale factor and a slightly more elaborate method of vertex selection. use of the stack-push/rtldbcl step defined below, which performs a sequence of push and relabel steps using a stack. The stack provides an alternative way of avoiding pushes large-€xcess vertices (other than to r). Stack-Push/ReUibel(r). Applicability: Vertex r is active. Action: Initialize a stack 5 to contain r Repeat the following step until Stack Step. Let v be the top vertex on S and Apply the appropriate Case let 5 is empty: (v,^) be the current arc out of v. one of the following cases: 1: (v,^) is not eligible. Case la: {v,-w) is not last by the next Case lb: {y,w) arc is last on on A(v). Replace (v,**-) as the current arc out of v y4(v). onA(v). Relabel the current arc out of v by the v and first arc pop it from on A(v). 5. Replace (v.w) as -8- Case 2: (v.h') is eligible. Case 2a: ^Cw) > A/2 and w*^t. Push Case 2b: e{w) < ning of from Some remarks it moves at w= it is added to and of which can be Our w begin- = 0, pop v nonsaturating push big if * If e{y) r). v while v is on S, at S call a During an execution of stack- otherwise. little vertex v can only be popped from Of the pushes from reduced to zero. if at the S. units of flow A S. A maintain e(yv) < push/relabel, every vertex pushed onto S, except possibly the when S. Perform push{\,-w) (modified as r. this section to onto about stack-push! relabel are in order. Let us A/2 least till or k- first, has an excess of after it is most two relabeled or at least its A/2 excess is are nonsaturating, only the last little. variant of the scaling algorithm, called the stack scaling algorithm, consists of phases A just as in the scaling algorithm. phase consists of repeatedly applying the stack-pushi relabel when step to a large-excess active vertex of highest label; a phase ends there are no large-excess active vertices. Lemma 3.2. The Oikn'^-t-n^QogtU + To bound Proof. Lemma namely 3.1, but 0= number of nonsaturating pushes made by total is l)). number of nonsaturating pushes, we use an argument the with two potentials instead of one. The e(,v)d(v)/A. J^ the stack scaling algorithm By first the analysis in the proof of potential Lemma that is 3.1, like the of proof of Lemma 3.1, every push decreases V tctive <I), the total increase in and the final decreases <I) <1> values of C) by To count over is at least 1/2. little pushes, all phases is 0(n^ logi U), and the difference between the initial O(n^). Each big push moves Thus we the number of big pushes at least is A/2 imits of flow, and hence O(n^(\ogt U+ divide them into two kinds, those that result in an empty stack 5, called emptying pushes, and those that do not, called nonemptying pushes. from a vertex v is such that e(v) was We e(v) decreasing to zero. 1/2 in <1> resulting from 1)). at least A/2 when v was added to 5, A nonemptying push and the push results can charge such a push against the cimiulative decrease of moving the original excess on v to vertices of smaller label. in at least Hence there can be only 0{n^ Qogt (/+!)) rwnemptying pushes. An emptying push namely the drop in <t) from a vertex v can be associated with a decrease of caused by the movement of the original excess on v, at least which is at l/k in least <t>, A/k, But using to smaller labeled vertices. U+ of only Oikn^Qogt tial, <1>2. The equal to the definition of minimum We 1)). count emptying pushes more carefully by using a second fwten- involves two parameters, an integer <1>2 during a phase. The set that P is and a The value of set P. / is P = 2n / consists of the beginning of a phase and that at vertices with label greater than all / nonincreasing / is and vertices with all from which an emptying push has been made during the current phase. Observe / empty definition of / of 2n and the smallest label of a vertex added to S while S was empty dur- ing the current phase. Observe that label equal to drop gives a bound on the number of emptying pushes this P beginning of a phase and at the never loses a vertex during a phase. The <I>2 is Z <I>2= e(v)(rf(vH+l)/A. = 0. (lf/» = <D2 0.) v€ P:e(v)>0 Observe a vertex to is /* < O2 ^ 2n^. Any emptying push can be associated that or with a decrease in P after the added to S but v e I logt (/ + over Ij with decreases in To bound to <1>2. Increases in fact that the relabeling since in <^2 due The at when <l>2 at is added to The number of the niunber of is is from S and <1>2 either v 4. drops by P when at least P vertices added to is at v \/k most emptying pushes not associated associated with decreases in v to F. in Thus / in relabelings contribute at is at most 2n^ A per phase. the decrease occurs every vertex in / [ log* 4/bi2+2/jn logifZ + lJ <I>2 is initially zero. <I)2, we bound the (A vertex added /. A <1>2.) relabeling of d(v) plus one; the "plus one" accounts for the P decrease in / most 4n^ Thus Thus has small excess. U +\\ Ik over the total to the by one adds at growth of most n/k to the total increase all [rfiases. nimiber of emptying pushes associated with decreases in in the v, are due to relabelings and to decreases in most the increase most 2n decreases total increase in <I>2. since As v push push has zero excess and hence adds nothing to may add to decreases in total 5.) number of emptying pushes a vertex v increases <&2 by <I>2. on (If the /k. P when phases, and hence so P because of an emptying There are is 1 <I>2. the total increase in all at least push, orv e because of pushes from v while v n of <1)2 either with an addition of <I>2 is at most k times the number of such pushes is at most .n Goldberg-Tarjan and Ahuja-Oriin algorithms, the time to perform saturating pushes and relabeling operations is choose vertices to add to S when S 0{nm). is empty. The only For this significant remaining issue purpose, we maintain is how to a data structure 10 consisting of a coUection of doubly linked 2n-l j € (1,2 We ). The change in label) or N e (' : e(i)> A/ k and d(i) = phase change (by at most pointer needs to be incremented or decremented is 0(nm + kn^ + n^ thus is 2n). Consequently, the 0(n^ + n Oog* (log* U + 1)). U+ 1)). each listij) is 0(1) time per push operation plus time this structure requires to a j] for which pointer can only increase due to a relabeling (by at most the due lime of the algorithm = also maintain a pointer to indicate the largest index j for nonempty. Maintaining tain the pointer. /«f(/) lists main- to amount of number of times The the overall running Choosing k ={ log U /log log U] gives the following result: Theorem O {run + n^ log Remark. = 2 until A< When rithm. [/' O to (nm + n^ log The algorithm must be changed and then switch to These phases account 4. improved be we the switch occurs, above with choice appropriate of nms k, in We slightly. where f/' /log log t/*). use a scaling factor of E which the initial phases (those in is as an with time. can u(s,v)/n. algorithm, scaling U) bound ^ v:(i,v)€ k stack t//loglog This =4 + t/* The 3.3. for only U replaced it =[ A increase A> U* /log log (if t/') is the log U"\ for the remainder of the algo- necessary) to be a power of same as that in the it. The remark following analysis of Lemma 3.1. O(n^) nonsaturating pushes. The analysis of the remaining phases by U* .O The Wave Scaling Algorithm Another way keep track of the observation is to reduce the number of nonsaturating pushes total excess, defined to be the that if the total excess is in the scaling algorithm is to sum of the excesses of all sufficiently large, the algorithm active vertices. The key can make significant pro- gress by applying slack-pushJ relabel to each active vertex in turn, processing vertices in topological order with respea to the set of eligible arcs. Even though some vertices of very small excess are processed, the overall benefits of this approach yield an the Slack scaling algorithm. wave algorithm of Taijan The even better running time than that of idea of processing vertices in topological order originated in the [20,21]; therefore we call the new algorithm the wave scaling algo- rithm. The wave factor, therefore shall choose step below is scaling algorithm seems to derive we later. fix A it = 2. no benefit from using a nonconstant scaling The algorithm uses another parameter / S 1 whose exact value we phase of the wave scaling algorithm consists of two pans. repeated until the total excess is less than n A//. First, the Then stack-pusk' relabel wave steps are applied to large-excess active vertices in any order until there are no large-excess active vertices. -11 Wave; Construct a list L of the vertices in eligible arcs. (Ordering tex V on L, Observe if V is L V [s,t] in - topological order with respect to the set of in nonincreasing order by vertex active perfonn stack-pushlrelabel{v). that the total excess is a nonincreasing function of time. beginning of a wave takes 0{n) time using a radix sort by vertex single wave wave scaling algorithm is For each ver- label suffices.) 0(n) plus time is 0(nm) a the total time required by the We 0(n) per wave plus 0(1) per nonsaturating push. plus the at The time spent during label. Thus for the relabelings and pushes. L Constructing complete the running time analysis with two lemmas. Lemma 0(n^ -K Proof. The number of nonsaturating pushes done by 4.1. (n^//)logt/) plus We separately. analysis in the proof of move Lemma at least 3. A/2 applies to 1 with the following improvement. At the end of a phase, the the potential at the beginning of the next phase the old; each vertex label A is is at most Thus 2n.) Oi(,n^/l)logU). which implies that the same argument gives excess when added the same bound on at least 1/2 in <I>. vertex to which stack-push! relabel is Lemma 4 2. The number of waves in the Proof. Consider any at least nA//. the the wave except The only way causes all vertices to numberof waves is 0{,nl O(n^). excess total sum of the increases in big pushes pnx)f of The remaining wave is Lemma litUe is <1> the last in a phase. is half of caused by changes in 0(n^ + (/i^//)log U). The vertices that have large 3.2 each such push can be at most one per D O (min(n/ + logf/,n^)). At the end of the wave, the on a vertex x is at the total end of a wave excess is is for x to relabeled, e{,x) remains constant until the end of single vertex total + \ogU). Furthermore, inactive, is Thus less than nAll. pushes consist of scaling algorithm for excess to remain become bound the number of big pushes, number of little pushes from must have occurred during the wave. Since the is is pushes little applied during waves, totaling at most n per wave. The maximum excess on any number of waves of flow) and units most 4n^/l. (The new value of A number of have been relabeled during the wave; once x the wave. is at to the stack 5, since as in the charged against a drop of scaling algorithm 0(n) per wave. coimt big pushes (those that The wave the a is A. It follows that at least nil relabelings number of relabelings wave during which no and hence terminates the is 0{n^), the total relabeling occurs entire algorithm. Thus the D Theorem 43. The mnning time of the wave scaling algorithm is 0(,nm + n^Oogt/)"^) if / is -12- chosen equal lo Qogt/)"^. By Lemmas Proof. 0(n/n -t-(n^//)logt/ OCwn -t- -^ and 4.2, 4.1 min n^Oogt/)"^ + (n^/ The bound t/*=4-»- Theorem in M(j,v)/n, by doing 5^ (A > U*) is the V') is as above with same = (\ogU)^'^ algorithm gives is bound of a min{/jlog(;.n^) ^n^Gogt/)"^. since D can reduced be waves only after as that in the remark following A< lo t/*. C>(n/n The -i- where /i^Oogt/*)"^). analysis of the early phases <, 5. Use of Dynamic Trees The approach taken Orthogonal approach Lemma 3.L The analysis of the later phases U replaced by U* D (A . in Sections 3 and 4 was to reduce the number of total pushes. An to reduce the total time of the pushes without necessarily reducing their is This can be done by using the dynamic tree data structure of Sleator and Tarjan We [18,19,20]. on the 4.3 n. l scaling £ (j.v)€ number. But min{«logt/.«^)). wave of the time Choosing nlogt/.n^)). -^ n\ogU S n^Oogt/)"^ implies Gogt/)"^ ^ Remark. running the total conjecture that, given a version of the preflow algorithm with a bound number of pushes, the running time can be reduced from 0{p) to ofp^ 0{nm log(-^ -i- run 1)) run by using dynamic we have been Although we do not know trees. the 0(,nm log (n^/m)) time from using dynamic trees with the FIFO selection case is Oin^). In this section we shall show O applied (nm log ( to the stack —— — m — f log logt/ ; -f 2)); scaling we omit rule; the that the rithm of Section 4, resulting in a time bound of be to prove a general theorem to this effect, able to obtain such a result for each version of the preflow algorithm that As an example, considered. how Oinm algorithm bound of Goldberg and Tarjan bound on the same idea applies log( of we have — m (log l/)"^ Section number of pushes to the + 3, 2)). wave results in this scaling algo- This idea can also giving a bound a description of the latter result since the former bound of is better. The dynamic tree data structure allows the maintenance of a collection of vertex-disjoint rooted trees, each arc of which has an associated real value. directed from child to parent, and dant of itself. The data we We regard each tree arc as being regard every vertex as being both an ancestor and a descen- structure supports the following seven operations: -13- find-root (v): Find and return the root of the tree containing vertex find-size (v): Find and return the number of vertices in the tree containing vertex find-value (v): Find and return the value of the tree arc leaving returned tie. choose the vertex Add change-value (v.x): real root of Combine link (v.H'.x): v. If v is a tree root, the value v. is infinity. Find and return the ancestor find-min (v): v. w of v with w closest to the tree number j: to the value minimum find-valueiyv). In case of a root. of every arc along the path from v to the its tree. the trees containing v and w by making w the parent of v and giving the arc (v.w) the value x. This operation does nothing if v and w are in the same tree or if v is not a tree root. Break the cut (v): two tree containing v into trees by deleting the A 0{h\og sequence of h (z -( In the the vertices. dynamic 1)) time Only a time. ^ n. We shall bound on the maximum ing algorithm except that it A on collection of singleton trees, takes initial tree size [10.18,1920]. tree arcs are a subset The value of a tree arc describe a version of the the size of a of the current arcs out of is its residual capacity. be moved along an entire path scaling algorithm, that uses this capability. the algorithm, a variable z maximum if z is the eligible arcs are tree arcs. at an tree operations, starting with tree data structure allows flow to call the tree S a tree root. network flow application, the dynamic along a single arc z, 1 is maximum dynamic Two excess tree. at wave at scaling algorithm, which an active vertex, and a fixed bound The algorithm is identical to the wave is active. r. we parameters govern the behavior of Tree-PushJRelabel{r) Action: Initialize a stack S to contain The once, rather than uses the following step in place ol stack-pushJ relabel: Applicability: Vertex r its This operation breaks no arc and parent; return the value of the deleted arc. returns infinity if v arc joining v to Repeat the following step until S is empty. scal- -14 Stack Step. Let v be the top vertex on S and let (v,h) be the current arc out of Apply S. the appropriate one of the follov.-ing cases: Case 1 : (v.h) Case la: is not eligible. (v,h) is not last on by the next Case arc on A (v). Replace (v,k) y4(v). lb: (y\V')islastonA{y). Relabel v and as the current arc out of v by the O'.v), Case 2: {v,w) as the current arc out of v first pop arc it from Replace (v,h) 5. on A (v). For every tree arc perform cutiy). Ltlx= find- root(w). is eligible. Case 2a: e{x) > t^ll andx * t. Push x onto S. Case2b: e(x)<Al2orx = t.Ltlt= min{e{v),Uf{v,w),find-min(\^,)}. Lei 6 = eifx = to r, 6 = min{E,A-e(x)) if x *t. Send 6 from v uruts of flow X by increasing /(v,h) by 6 and performing change-value (h,-5). (This is scuurating called tree a The to x. perform cut{find-min{w)). > and While If e{y) find-size{yv) = find-value 0, + pop push tree S = min [uji\\w),find-min (w)] bcfoTZ the if nonsaturating otherwise.) u/v.H') push from v (find-min push is and = 0, (w)) v from S, and if in addition find-size(v) < perform z, link (v,w,uj(v,w)). The dynamic arcs. tion, tree scaling algorithm stores flow in tree arcs and implicitly (in the two dynamic different ways: explicitly for edges that are not tree data structure) for arcs that are After each cut, the flow on the arc cut must be restored to when computed. the algorithm terminates, the correct flow value its dynamic tree correa current value. In addi- on each remaining tree arc must be For arcs cut during the computation, the desired flow values are returned by the corresponding cut operations. Computing correct flows on termination can be done using We n find-value operations. at most have omitted these bookkeeping steps from our description of the algorithm. The algorithm maintains tree arc tree is eligible, push big if it the following invariants: every active vertex no excess exceeds A, and no moves given vertex v while v is at least on S, at A/2 tree size units of flow, and exceeds little z. Let us otherwise. most two are nonsaturating and at is a tree root, every call a Of nonsaturating the pushes from a most one (the last) is small. -15- The tree scaling algorithm is a variant of the d>'namic tree algorithm of Goldberg and Tar- jan [9,10]. Their analysis applies to give the following Lemma 5.1 [10]. 0(\og{z + The time required by the tree scaling algorithm total is 0{nm time per tree push plus the time needed to construct and scan the 1)) The number of links, steps. result: Making cuts, and saturating tree pushes is + log(z list plus 1)) L during v;ave 0{nm). the tree scaling algorithm efficient requires careful implementation of the list used in wove steps. For the moment we ing issue in analyzing the algorithm is L manipulating L. The remain- shall ignore the time spent bounding the number of nonsaturating pushes. To do this we need two lemmas. Lemma 52. The number of waves Proof. Identical to the proof of the same result for the Lemma 0(nm Proof. to The number of nonsaturating 5.3. The potential function the number of Any follows. little <I> used in Section big tree pushes by tree push, say event an activation 0{nm + D is O 3, (n^ from a vertex + v, as applied in the (n^//) log U). of We v. shall derive a We count reduces ^(v) to zero. that made Lemma proof of little We e(v) nonzero. tree shall We bound on the number of 3.3, serves pushes as count such a call such an activations of in^/l) log t/)plus 0{nlz) per wave, thereby proving the lemma. preflow/at the beginning of the Initializing the Every other activation results in a link or cut, larly, if the tree push charges account for X = find-root{w), is is we due to a tree we the push. more than z/2 If activa- such a tree charge the activation against the arc saturation. Such activations. produced by a which find-size(v) + find-sizeiw) > z, and T^ be the dynamic trees containing v and w, respectively. contains 0{n) vertex push (case 2b of tree-push' relabel). activation, say of a vertex x, is after entire algorithm causes charge the activation against the corresponding link or cut. Simi- saturating, 0(nm) Any remaining to (Lemma 4.2). scaling algorithm pushes done by the tree scaling algorithm tree push against the most recent event before the push push wave (min [nl + \ogU,n^)). -»-(n^//)log[/)plus C>(rt/2) per wave. bound tions. O in the tree scaling algorithm is vertices and small otherwise. One of tree no since We push through an link call a is arc (v,h) performed. Let T^ dynamic tree large if it Ty and r» must be large just after — ; 16 If the tree push above counting big the push wave. accounts for 0(n^ + (n^//) log reduces e(v) to zero. There can be it at U) Otherwise, most one such push from v per has changed between the beginning of the most recent wave and the push, If Ty most one per Similarly, the argument activations. the activation of x to the link or cut that most recently changed T^. There are at By charge the activauon of x against the push. tree pushes, this and thus is little, we big, is if link, at most two per cut, since vertex v is the root T^ has changed between the beginning of the Oinm) such when of Ty push occurs. or T^ If neither Ty large. is Each nor r» has changed, total the claimed Theorem bound on vertex The number of 5.4. chosen equal to min max (n, tree 0(nm) such at the all :r T^ when at our estimates gives D logL'}) and / is chosen equal to m/n is if z = 0(nm) 1, if z is — logU m if <z<n. Proof. By Lemmas Oinm + in^/l) Case 5.2 logU + Oinm and — min 5.3, [nk the number of + logt/.n^ )). —7-logf/Sl. 1: Then m 0{run + {n^ /m)\ogU is most twice beginning of any m^ \ the whichever of Ty to pushes done by the tree scaling algorithm — (1, x wave can be charged 0(n/z) per wave. Combining is activations. the root of fewer than 2n/z large trees tfiere are number of such charges is the activation of large tree existing at the beginning of a (once as a Ty, once as a r»). Since wave, the we charge charges, most recent wave and the push, we most once per wave, and x at charge the push occurs. charge the activation of x to the link or cut that most recently changed T^. There are charges, since a vertex x can be activated we + n minim + ]ogU, z = n^]). pushes done by the algorithm is We consider three cases; and l tree l = mln. The number Since logU ^m^/n^, the of tree pushes bound on tree is pushes min{m^/n, n^}) = 0(nm), because Tn}ln<,n} implies m<ji^, which means -i- rn^ln ^ nm, and m}ln S n} implies m t n^, which means n' ^ nm. (This analysis allows for the possibility of multiple arcs in G.) Case 2: 1 < —„2r-logU < Then 2 tree pushes is C>(n/rj+( —n logty 0{nm + min{m^/n, n^)), since number of tree pushes is Oinm). —ylogU f^l n. z —m = and / = —„ \ogU. The number of 2 2 ) min{ logl/ + logt/,n^)) = 0(nm + min (m^/n.- \ogU <m^/n^. Since min(m^/n,fi') ^ nm —]) = iogu (see Case 1). the — 17 Case —^2 0(wn + min( Observe \ogU ^ r- 3: Then n. logU + logU.n^ m that if z is time per dynamic tree operation of the 0(nm log ( — Gogt/)"^ + and n 0(\og(z + 5.4, 1)) with / = —„ logU. The number of tree pushes is D Theorem in algorithm, scaling tree is = = 0(.nm). ]) chosen as z k i.e. equal to min{n, = 0(\og and Qogf/)"^)). — m ( chosen z as — m f^2 max {1, Thus r- \ogU] the the running time Theorem in ), 5.4, is 2)) (igrwring time spent manipulating L). tn All that remains fonmed list, in 0{nm log( is to show that the manipulations of the Gogt/)"^ + — m for then the time scanning L 2)) time. will be It is in turn represented by a balanced minimum-cost flow algorithm tree. we represent wave L this steps can be per- L simply as a lirJced scanning time will dominate the as a list of sublists, each of which the method differs from theirs in that represent the sublists by ordinary balanced search trees instead of finger search trees, and the size of each sublist to z. the maximum is This idea was used by Goldberg and Tarjan in a Our version of [11]. in not sufficient to represent 0{n) per wave, and time for the rest of the computation. Instead, L list tree size in the tree scaling algorithm. we we limit These changes lead to an analysis that parallels the analysis of the tree pushes. The details of the data structure are as follows. The computation so that inates the need its vertices are in topological order with to reconstruct L at the list L respea beginning of each wave. order merely requires moving each relabeled vertex to the front of List L is maintained as a doubly-linked have size (a) all sublists (b) any active vertex The at is last most on list maintained throughout the to the eligible arcs; this elim- Maintaining L when it is L in tofwlogical relabeled. of sublists. These sublists have two properties: z; its sublisL sublists are represented as balanced search trees, e.g. red-black trees [20] or splay trees [19,20]. This representation supports the follosving op>erations (i) is Initialize a sublist to contain a given single vertex. on the sublists: -18- number of vertices given sublisl. 00 Find the Oii) Find the sublist containing a given vertex. Ov) Find the last vertex in a given sublist. (v) Split the sublist containing a given vertex just before (or just after) the vertex and return the two resulting sublists. Concatenate two (vi) The time required and 0(\og(z + in a 1)) for sublists and return the resulting for these operations each operation of types is 0(1) sublist. for each operation of the types (iii)-(vi), assuming that no and (i) sublist size ever (ii), exceeds 2. During the tree scaling algorithm, the each vertex other than s and / is computations done on When lisl the sublist containing v is Each time a vertex v is relabeled, the sublisl containing v containing v is moved from is split Initially, and these sublists are is activated (i.e. This maintains property split just after v. a vertex v its are as follows. initialized to be a single-vertex sublisl, ordered in nonincreasing order by vertex label. becomes nonzero), L e(v) (b). and the (singleton) sub- just before v, current position to the front of L. Concatenation of sublists takes place only during waves. vertex v to be the last vertex on the first sublist A wave consists of initializing of L, and repeating the following step until v is null: Scan. Apply the appropriate one of the following cases: Case tices 1 : V is Perform stack-push/relabel{v), active. splitting sublists at newly active ver- and moving relabeled vertices (except for v) to the front of L as described above. has been relabeled, sublist after v, or move j: by to the front Case 2: v is let j: be v, and proceed as follows: Replace v by the null if there is no such sublisl; split fl'. If inactive. B (the old v) vertex on the last from its sublist and of L. If v is in the last sublisl, replace v be the sublists contairung v and the vertex after tex in x If v v, by null. Otherwise, respectively. Replace v and B' together contain no more than z vertices, let B by the concatenate B and B' last ver- and B'. 19 Note then V that, during a wave, immediately reprocessed is The analysis of the list a stack-pushJ relabel applied to a vertex v does not relabel if O Gog (z + processing that takes place during waves ing an execution of case 2 (those in which B B and ' is 0{nm Proof. + log (z 5.6. 1)) 1)). more than total 1)), if z and time 2> is 1 dur- (n/z) executions of case 2 per wave z vertices), / are chosen as in The is O L processing spent Theorem (nm). So is each execution of case 2 causes a to min{rt, max{l, — m^ r- log U} and /is during number of the splits by at most the tree algorithm scaling is 5.4. number of tree pushes, by Theorem the tree scaling algorithm runs in 2 chosen equal O a execution of case The time spent processing L per relabeling. Except for like the analysis most the number of tree pushes plus the number of relabelings. is at The number of relabelings Theorem + much the following result: The 5.5. + (z together contain n-1, and the number of splits Lemma Gog (z The number of concatenations can exceed sublist concatenation. Thus we obtain O is The time spent processing L during O Gog per tree push plus 1)) Case 2 oi scan. in already done to count tree pushes. v, — Gog U) m — = chosen equal O {nm log ( to if z +2)) time 1 or to n 5.4. D if z is — log m f/ if 1. Immediate Proof. log (z + 1) = O Gog Theorem from (— Gog Uf^ + Lemma and 5.4 5.5, since —+ 2), analo- 2)). \I/2 Remark. The bound in Theorem 5.6 can be improved to O gously to the improvements in the bounds of Sections 3 and run the stack scaling algorithm until 6. Bounds in A^ U*, and then switch a Semilogarithmic Computation The time bounds derived 4. To ^ ( m obtain this improvement, to the tree scaling algorithm. we D Model in Sections 3-5 are all U (nm log based on the assumption that addition and U huge, this assumption comparison of integers of magnitude at may explore the consequences to our results of using a semilog- be unjustified. In this section we most takes 0(1) time. arithmic computation model, in which each computer word any operation involving 0(1) words takes 0(1) time. In this is If is allowed to hold model, all O (logn) bits and the elementary graph and . 20- list manipulation operations needed by our algorithms take 0(1) time each, but adding or com- paring two capacity or flow values can take O Oog„ V) time if an exact answer required. is Thus a straightforward translation of our results into the semilogarithmic model increases each of the time bounds by a factor of By Gog„ suitably modifying the algorithms, however, of our algorithms requires Thus O example for (nm log ( 6 (m ties is t/). — Gog f/)"^ + m log, U) running in this 2) + possible to reduce the extra time each semilogrithmic model to an additive term of in the the it is m time of the tree scahng O (m log, U). algorithm log, U). Note that the time needed to read all becomes the arc capaci- model. The general approach to approximately solve a sequence of is O Qog, U) closer-and-closer approximations to the original problem. Each approximation uses as a starting point the approxi- mate solution O of only Gog n) Making this bits. approach work involves a number of messy technical detaQs. Since the result mainly of theoretical interest, a is power of where = 5i t///i*. assume (without G ^ We Observe exactly. = log, that for k «t_i (v.w) -Uk(v,w) solve problem log, U, we define problem kfoTk = k, all ^ 5* t/, = 1; to )t is a power of two and be the Ut(v,w)=\ thus problem log, is modifying the algo- in loss of generality) that n with arc capacities w* (v,^) defined by lem. Also, for a general value of arc (v.w), merely sketch the ideas involved shall For k = 1,2 n. problem on the graph we We rithms of Sections 4 and 5. that t/ Solving each problem requires manipulation of integers to the previous problem. f/ is maximum flow u(v.u')/5tl 5^, the original prob- capacities in problem k are divisible by 5*; and. for every 6i_i 1.2, ....log, (7-1 approximately and then solve problem log, Throughout the computation we maintain a preflow / and a valid labeling d U for the current problem. Preflow /satisfies the following constraint: e{v) ^ min "^ { f(u,v), n(5t-\) ) for all v *^ (flow holdback constraint). (5) /(y.v) > (In inequality (5). the For a vertex from V, is a(v) v, sum over/(u,v) is taken to be zero the available excess at v. = max {0,e(v)-n(5i-l) ). which is if /(u,v) the S amount for all arcs (u,v).) actually allowed to be pushed Throughout the computation, the available excesses used in place of the actual excesses to determine when vertices are active and how much are flow can be pushed. The flow holdbacks to one problem into a are good needed initial to maintain the preflow property when preflow for the next problem. For the first converting a solution problem, the preflow 21- /and valid labeling Once a solution to problem d are initialized exactly as in Section 2 (using the arc capacities «i(v,w)). k-l is by replacing the current preflow computed, /by is converted into an is obtained from (v.w) by an amount between zero and mm[f{v,w), 5t-i dity of the flow holdback constraint for /in constraint forf in problem k. For a(v) I <k < < 2n(5i-l) f is for every active vertex v. valid labeling Thus f constraint implies that a valid labeling / and log, U, a preflow decreasing the flow on each arc = (inclusive). Since S^.j by construction. Since every problem k.d in = min{/(v,H'),M4(v,>v)). arc saturated for/ d in problem is by / in at problem k-l k. constitute a solution to a solution to problem log, U problem k every active k, most 4n^5t. of which 3n^5t = 3n5t_i comes from the excess on v initializing the preflow for problem bound on maximum available excess) number of for problem k is phases, continuing until the maximum available excess happens by the time phases needed 21ogn 3. -I- is at A is reduced to nS* (or to 1/2 most log n + Thus each problem subproblems (These are overestimates.) The k. is O (logn log, 2; if requires U) = k= log, OQogn) 4n^5k. Problem k if /t = log, U). initial is is at Uk < value of in to /in A (the solved by performing most 2n (5t-l), which number of log, U, the U, the number of phases needed phases, and the total if maximum gives a problem k-l (since a(v) < 2n(5t_i-l)), and n^5t = n5k-i comes from the changes made a f a preflow, since flow in the original network. After the initialization of the preflow for problem vertex has an excess of nS*. the vali- problem k-l implies the validity of the flow holdback The flow holdback satisfies the capacity constraint remains saturated by ) /by preflow for problem k initial the preflow/' defined by /'(v,H') 0^ M4_i(v,H')-«t((v,H') < 5i_i,/' Since it is at most number of phases over all (log U). During the solution of problem k, the preflow /is maintained so lhat/(v,H') is a multiple of 5i for each arc (v.w). (This happens automatically, since A. the initial flow values, and all capa- multiples of 5^). Thus the flow values and capacities can be represented in units of 6*. cities are Furthermore, the flow values and capacities are not represented explictly, but rather as differences from the let /o (v,^). initial flow values. = 0. Then be more precise: let/4_i be the the current preflow The capacity fuiKtion each arc (v.w). To We claim u^ is that the > 9n' represented by the value amount by which n A <4n' is To 5* units of flow can be prove the claim, min the flow at 5*, the extra residual capacity used and can be ignored. preflow for problem k-l\ /is represented by the value f{v,'w)-fk-\ (v.w) for each arc tion of problem k and subsequent problems "i (v.H')-/t(v,H') final most {«t(v,H')-/t_i(v,H'), on an arc can change during 8/j' 5*. due to is at if (beyond 9n' 5*) on arc (v.w) will never be we note that between relabelings moved through any given modifying /between subproblems for the solu- This claim implies that arrc, and there are belings over the entire algorithm. This accounts for 8n' 5* units of change. arc 9n' S^) most < 2hk.\ J^ 6^ j-k-\ = 2n at at most In} most rela- The change on an 5*. Thus the claim 22 is true. Storing /and ut in such a difference form, in units of 6*, allows the algorithm to manipulate numbers consisting of only 0(\ogn) and bits, necessary additions and comparisons of flows all and capacities take 0(1) time. Constructing the final preflow is when together the successive flow differences /i-/o,/2-/i.-- computed By lems. and the adding these differences from right to time total for each problem 0(m log^ U). This number of scaling algorithm relabelings nonsaturaiing pushes 0(min [nl + log U, n^ is O is becomes n^ +log;, U; also the total time required for initializing the preflow is is used, the bounds in Section 4 remain valid almost without + (n^ + log, this is bound of 0{nm + n^ Oinm of log( the U) (n^/l) log Gog — m t/)"^ U problems. is the only 0(nm), is the one Specifically, the number of number of waves that changes, in that is n^ because a wave without relabelings terminates only the solution of m + + 2) + m log, Chooseing L and list Section of To obuin log, U). the for tree pushes associated with vertices that / = Gog U)^'^ gives an overall time. if) algorithm scaling time required for initializing the 0(m) log„ 0(n) per wave, and plus Tht bound on waves U]). (log l/)"^ tree all O(n^), the number of saturating pushes the current problem, and rwt the entire algorithm. Use made 0(m), the time per addition can be left, modification, and apply to the calculations involved in solving the solving successive prob- (Oim) time per problem). wave If the is merely a matter of adding this dynamic become 5 results a in bound time of bound, we must verify that the extra trees for each problem, and the extra time active at the beginning of a new problem, is per problem. We need two extra data structure, the flow values for ermore, a new set dynamic facts about the all of flow values for the all dynamic tree data structure. tree arcs By can be computed traversing the entire in 0{n) time. Furth- these arcs can be installed in the data structure in 0(n) time. These facts can easily be verified by checking the description of the data structure [19.20]. When the flow /is modified at the beginning of a new problem, new excess are created, possibly as many part of the initialization of the new problem. To begin dynamic tree arcs is computed explicitly. and capacities are modified to their available excess and is is set as n-2. initial greater than the total excess Next, the vertices of C are on all A Such a step either relabels v or reduces vertex v is scanned by applying new problem, 0(n) time values for the is a is the hardest the current flow as noted above.) Then on all the flow new problem. The bound on maximum n times the value proposed eariier in this section, active nodes.) scanned arcs. Handling these newly active vertices (This takes equal to 4n' 6*. (This vertices with available to its in topological order with respect to the set it of eligible a pushlrelabel step of the kind defined in Section 2. available excess to zero. After all vertices have been 23 scanned, all the available excess is on vertices that have been relabeled during the scanning. The current flow values for dynamic tree arcs are reiosuied in the d>-namic tree data structure, and every dyiiamic tree arc that has been saturated during the scanning or that has had one of vertices relabeled cut Finally, the is list L is reinitialized by sorting the vertices order with respect to the set of eligible arcs and constructing one sublisi in tex with V as V. tex. Constructing can be 0{n) ning in the initialization plus (9Gog(r -K A Then the tree scaling algorithm problem for each is 0{m). The time The time to initialize timing analysis for the tree scaling algorithm a total time L Goldberg and Tarjan 7. increased, the The time -fm [8,10], log^, resulting 0{m). Once is number of phases to carry out all the scan- 0{jn) ( same —m Gog t/)"^) + a bound time + m log^, maximum the in initialization, and the as the analysis in Section 5. 2) also be applied to the in been com- the initialization has been relabeled during the virtually the is bound of O (nm log The techniques discussed above can {run log(/i^/m) overall. begun. to initialize the d>Tiamic tree data structure is pleted, the only active vertices are those that have O is is per cut; the time for a cut can be charged against the corresponding arc satura- 1)) tion or vertex relabeling. Thus we obtain that foUov^' the last active ver- pairs of by \ogn per subproblem, or logl^ increases, but only for each active ver- 0{x) time by doing repeated pair-wise concatenanon (concatenating starting value of the in topological x items singletons, then pairs of pairs, and so on). Because end time, since a binar>- search tree containing the sublists takes all initialized in L vertex, and one sublist for any vertices in its last L its U). flow algorithm of semilogarithmic model of U). The details are straightforward. Remarks The algorithms of Section may be very efficient these algorithms Section 5 chance is is in practice. and 4 not only have a good theoretical time bounds, but they We hope to perhaps mainly of theoretical that the use for the of dvnamic trees maximum cost flow problem. conduct experiments to determine whether either of competitive with previously The two obvious open bound 3 It is may known methods. The interest, although for huge nenAorks there is is of some be practical. theoretical questions are flow problem tree scaling algorithm whether further improvement in the time possible and whether our ideas extend to the not unreasonable to hope for a bound of 0{nm) for the minimum maximum flow problem; note that the bounds of Theorems 4.3 and 5.6 are 0{.nm) for graphs that are not too sparse and whose better than 0{nm) would seem arc capacities are not too large, to require i.e. major new Oogf.')' ideas. * = 0{m 'n). Obtaining a bound 24- As 0(nm a pania] loglog assuming all U answer to the log (nC)) for the minimum we have been / ^ C US able to obtain a time cost flow problem, where arc costs are integral [2]. This result uses additional ones. b second question, some C is the maximum bound of arc cost, ideas in the present paper and some -25- 8. Acknowledgements We 9. Andrew Goldberg thank for inspiring ideas and stimulating conversations. References [I] R.K. Ahuja and J.B. Orlin. "A and simple algorithm for the fast maximum flow problem." Technical Report 1905-87, Sloan School of Management, M.I.T., 1987. [2] R.K. Ahuja, A.V. Goldberg, J.B. Oriin, and R.E. Tarjan, "Finding minimum-cost flows by double scaling.*' [3] J. To appear. Cheriyan and S.N. Maheshwari. "Analysis of preflow push algorithms for work flow." Department of Computer Science and Engineering, Indian nology, [4] J. New maximum Institute net- of Tech- Delhi, India, 1987. Edmonds and R.M. Karp. "Theoretical improvements in algorithmic efficiency for net- work flow problems." Journal of the ACM, 19:248-264, 1972. Even. Graph Algorithms. Computer Science Press, Potomac, [5] S. [6] R.L. Ford, Jr. and D.R. Fulkerson. Flows in MD, 1979. Networks. Princeton University Press, Prince- ton. NJ, 1962. [7] H.N. Gabow. "Scaling algorithms for networic problems." J. of Comp. and Sys. Sci., 31:148-168, 1985. [8] A.V. Goldberg. "Efficient Graph Algorithms for Sequential and Parallel Computers." Ph.D. Thesis. M.I.T., 1987. [9] A.V. Goldberg. "A New Max-How Algorithm." Technical Report MIT/LCS/TM-291, La- boratory for Computer Science, M.I.T.. 1985. [10] A.V. Goldberg and R.E. Tarjan. Proc. 18th Mach., [II] ACM "A new approach to the maximum flow problem." Symp. on Theory of Computing, pages 136-146. 1986; J. In Assoc. Comput. to appear. A.V. Goldberg and R. E. Tarjan. "Finding minimum-cost circulations by successive approximation," Math ofOper. Res., to appear. [12] A.V. Karzanov. "Determining the maximal flow in a network by the method of preflows." Soviet Math. Dokl.. 15:434^37. 1974. [13] E.L. Lawler. Winston, New Combinatorial Optimization: Networks and Matroids. York. NY. 1976. Holt, Reinhart, and -26- [14] V.M. Malhotra, M. Pramodh Kumar, and S.N. Maheshwari. finding [15] maximum C>(IVp) aJgorithm for flows in networks." Inform. Process. Lett., 7:277-278, 1978. C.H. Papadimitriou and K. plexity. Prentice-hall, [16] "An Sleiglitz. Englewood Y. Shiloach and U. Vishkin. Combinatorial Optimization: Algorithms and Com- Cliffs, NJ, 1982. "An 0(n^ logn) parallel max-flow algorithm." Journal of Algorithms. 3:\2S-U6,\9&2. [17] D.D. Sleator. port [18] logn) Algorithm for ST AN-CS-80-831. Computer Science D.D. Sleator and R.E. Tarjan. 5c/.. [19] "An 0(nm "A Maximum Network Flow." Technical Re- Department, Stanford University, 1980. data structure for dynamic trees." /. Comput. System 26:362-391, 1983. D.D. Sleator and R.E. Tarjan. "Self-adjusting binary search trees." J. Assoc. Comput. Mach. 32:652-686, 1985. [20] R.E. Tarjan. Data Structures and Network Algorithms. Society for Industrial and Applied Mathematics, Riiladelphia, PA. 1983. [21] R.E. Tarjan. "A simple version of Karzarwv's blocking flow algorithm." Research Utters 2:265-268. 1984. b / Go Operations n Date Due "^'^ ' Lib-26-67 MIT LISR4R1ES i!i|!;i||i;[![i|iiiiiiiiiiiMiiiiiL 3 TDfiD DDS 22E MDfl iiiispiiiiilPia^^