JOURNAL OF ALGORITHMS ARTICLE NO.
25, 1]18 Ž1997.
AL970864
Tight Bounds for the Maximum Acyclic Subgraph Problem* Bonnie Berger † Mathematics Department and Laboratory for Computer Science, Massachusetts Institute of Technology, Cambridge, Massachusetts 02139
and Peter W. Shor AT & T Labs, Florham Park, New Jersey 07932 Received June 3, 1992
Given a directed graph G s Ž V, A., the maximum acyclic subgraph problem is to find a maximum cardinality subset A9 of the arcs such that G9 s Ž V, A9. is acyclic. In this paper, we present polynomial-time and RNC algorithms which, when given any graph G without two-cycles, find an acyclic subgraph of size at least Ž1r2 q V Ž1r D Ž G . ..< A <, where DŽ G . is the maximum degree of G. This bound is existentially tight, since there exists a class of graphs without two-cycles for which the largest acyclic subgraph has size at most Ž1r2 q O Ž1r D Ž G . ..< A <. For the common case of low-degree graphs, our algorithms provide an even better improvement over the known algorithms that find an acyclic subgraph of size 12 < A <. For example, for graphs without two-cycles, our algorithms find an acyclic subgraph < < Ž . of size at least 23 < A < when DŽ G . s 2 or 3, and 19 30 A when D G s 4 or 5. For DŽ G . s 2, this bound is optimal in the worst case. For 3-regular graphs, we can 2 < < < < achieve 13 18 A , which is slightly better than 3 A . As a consequence of this work, we find that all graphs without two-cycles contain large acyclic subgraphs, a fact which was not previously known. The results can also be extended to find large acyclic subgraphs of graphs with two-cycles. Q 1997 Academic Press
'
'
*A preliminary version of this paper appeared in w3x. Supported in part by Air Force Grant AFOSR-86-0078. Work done in part at AT & T Bell Labs, Murray Hill, NJ. †
1 0196-6774r97 $25.00 Copyright Q 1997 by Academic Press All rights of reproduction in any form reserved.
2
BERGER AND SHOR
1. INTRODUCTION Given a directed graph G s Ž V, A., < V < s n and < A < s m, with no self-loops or multiple arcs, the maximum acyclic subgraph problem is to find a subset A9 of the arcs such that G9 s Ž V, A9. is acyclic and A9 has maximum cardinality. An alternative formulation of this problem is the feedback arc set problem which is the problem of determining, in a directed graph, a minimum cardinality set of arcs that breaks all cycles. These problems are NP-complete w8, 9x and arise in many applications, including machine shop scheduling w13x, generation of test vectors for circuits w20x, register minimization in VLSI design w20x, feedback minimization in systems w17x, and circuit simulation through functional abstraction w11x. Most of these applications involve low-degree graphs, for which our algorithms work particularly well. In the case that the degree of each node i, degŽ i ., is < V < y 1, a maximum acyclic subgraph corresponds simply to a tournament ranking. A tournament ranking is an ordering of players from ‘‘best’’ to ‘‘worst,’’ where we maximize the number of times player A has beaten player B and we have assigned A a higher rank than B. In the special case of reducible flow graphs, Ramachandran w17x achieved a polynomial-time algorithm for finding a minimum feedback arc set. In general, however, relatively little has been discovered about the approximability of the maximum acyclic subgraph problem. The best previously known polynomial-time algorithms found an acyclic subgraph with at least half the arcs in G. For graphs that consist solely of two-cycles, this performance is the best possible in terms of < A <, since half the arcs must be removed to break all cycles. For the class of graphs that contain no two-cycles, the previously known algorithms still achieve exactly half the arcs in the worst case. One contribution of this paper is to attain better bounds when the graph does not consist solely of two-cycles. In particular, we first show that we need only consider graphs without two-cycles, since two-cycles can be dealt with optimally; i.e., we give a procedure for including exactly one arc from each two-cycle in any acyclic subgraph A, found for a graph G s Ž V, A. with two-cycles removed. This procedure will turn an approximation algorithm for graphs without twocycles into an equally good approximation algorithm for graphs with two-cycles. We then provide deterministic polynomial-time and randomized NC Ž RNC . approximation algorithms which do strictly better than 12 < A < for graphs without two-cycles through a substantially more complicated analysis, which involves setting the problem up as a discrepancy-based problem.
3
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
More specifically, we devise linear-time randomized and O Ž< V < < A <.-time deterministic algorithms that find an acyclic subgraph Aˆ with at least < A
'
Related Work Building on this paper, Berger w2x has developed RNC and NC algorithms that find an acyclic subgraph with at least < A< 2
qV
deg Ž ¨ . q
žÝ' ¨ gV
Ý
¨ gV
< d out Ž ¨ . y d in Ž ¨ . <
/
arcs. This result generalizes and improves upon the corresponding < A
4
BERGER AND SHOR
For feedback vertex set in directed planar graphs, Stamm w23x has a 2-approximation algorithm, and Goemans and Williamson w7x have a 9r4-approximation algorithm. Papadimitriou and Yannakakis w14x showed that the maximum acyclic subgraph problem is complete for MAX SNP. By work of Arora et al. w1x, this means that if P / NP, there exists some constant e such that no polynomial-time algorithm is guaranteed to achieve Ž1 y e . times the number of arcs in the largest acyclic subgraph of the graph. Outline of the Paper In Section 2, we review the previously known approximation algorithms that get half the arcs. Then in Section 3, we introduce a new discrepancybased technique and show how it can be easily used to get half the arcs. In Section 4, we describe our technique for two-cycle removal and reintroduction. As this technique deals optimally with two-cycles, in the remaining sections, we focus solely on algorithms that work on graphs without two-cycles. In Section 5, we describe a polynomial-time randomized algorithm, which is based on the technique of Section 3 and achieves the better bound through a substantially more complicated analysis; the polynomialtime randomized algorithm is then transformed into a deterministic algorithm using the method of conditional probabilities, developed through the papers of Erdos ¨ and Selfridge w5x, Spencer w21, 22x, and Raghavan w16x. As usual, the hard part of this transformation is calculating the conditional expectations exactly and efficiently.
2. REVIEW OF PREVIOUSLY KNOWN ALGORITHMS We review two algorithms for the maximum acyclic subgraph problem. By the nature of their approach, these algorithms do not seem amenable to achieving better than twice optimal Žhalf the arcs. in the worst case, even for graphs without two-cycles. The first approach uses a greedy strategy for arc inclusion in an approximate acyclic subgraph. The algorithm maintains two sets S and T. It greedily goes through all arcs of the graph G s Ž V, A., adding an arc to S if with its addition GS s Ž V, S . remains acyclic, and otherwise adding the arc to T. When all arcs have been processed, the larger of S and T is selected for the approximate acyclic subgraph. It is easy to show that since GS s Ž V, S . is acyclic, GT s Ž V, T . is acyclic. Note that there are graphs and orderings of the chosen arcs for which this technique gives < S < s < T <.
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
5
The second algorithm works as follows. It arranges the vertices of the graph G s Ž V, A. in some order from left to right on a line and then adds in all directed arcs of the graph. Those arcs directed from left to right are put in set S and those directed from right to left are put in set T. The larger of these two sets is chosen for the approximate acyclic subgraph. It should be obvious that neither GS s Ž V, S . or GT s Ž V, T . contains a cycle. Here again, note that there are graphs and orderings in which the vertices are laid out for which this technique gives < S < s < T <. 3. A NEW ALGORITHM WHICH GETS HALF THE ARCS We introduce a new technique and show how it can be used to give an alternative approximation algorithm for the maximum acyclic subgraph problem. We will explain the technique in terms of a sequential algorithm, but it is easy to parallelize. We will call our general technique Algorithm AŽ G ., which takes the graph G s Ž V, A. as its input. Algorithm AŽ G . processes the vertices of G, in any order, as follows. When processed, if a vertex has more incoming arcs than outgoing ones, the incoming arcs are removed from the graph and added to set Aˆ and the outgoing arcs are removed from the graph and thrown in the trash. In the case where a vertex has at least as many outgoing arcs as incoming ones, we add the outgoing arcs to the set Aˆ and discard the incoming ones. When all vertices are processed, Aˆ is returned. THEOREM 1.
Algorithm AŽ G . selects an Aˆ such that < Aˆ< G 12 < A <.
Proof. Algorithm AŽ G . examines each arc in G once and always adds at least as many arcs to the approximate acyclic subgraph as it throws away. THEOREM 2. acyclic.
ˆ s Ž V, Aˆ. is Algorithm AŽ G . selects an Aˆ such that G
ˆ contains a cycle x 1 , . . . , x k , x 1. Without loss of genProof. Suppose G erality, let x 1 be the first vertex in this cycle processed by Algorithm AŽ G .. Then either arc ² x k , x 1 : or arc ² x 1 , x 2 : would have been thrown in the ˆ a contradiction. trash. But then, x 1 , . . . , x k could not form a cycle in G, THEOREM 3. The running time of Algorithm AŽ G . is O Ž< V < q < A <.. Remark 1. Observe that Algorithm AŽ G . may discard an arc not contained in any cycle. To prevent this, we can add an extra step before processing each vertex of G. We run a strongly connected components ˆ s Ž V, Aˆ. Ževerything we haven’t thrown in the algorithm on the graph G trash. and put all arcs that go between strongly connected components
6
BERGER AND SHOR
ˆ This modification may also be made to the algorithms based on into A. Algorithm AŽ G . discussed later in this paper. It adds O Ž< V < ? < A <. to the running time of an algorithm, and although it does not improve our theoretical results, it may improve the performance of the algorithms in practice. 4. A TECHNIQUE FOR TWO-CYCLE REMOVAL AND REINTRODUCTION In this section, we introduce our technique for two-cycle removal and reintroduction. We will first explain the technique in terms of a sequential algorithm, and then discuss how to parallelize it. Basically, the technique works as follows: given any graph with two-cycles, we remove all two-cycles from the graph, run on the remaining graph an algorithm for the maximum acyclic subgraph problem that works on graphs without two-cycles, and then reintroduce one arc from each two-cycle back into the acyclic subgraph while keeping it acyclic. We will need the following definitions. The performance ratio of an approximation algorithm is < Aˆ
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
7
parallel algorithms for maximum acyclic subgraph presented here have this property.. More precisely, suppose that we have a processor for each vertex and each arc in G, and an incoming and outgoing adjacency list in shared memory. Then, Step 1 can be implemented by having each arcprocessor do a binary search of the adjacency list of one of its incident vertices, looking for a two-cycle. The updated graph, G 2 , can then be obtained using standard parallel algorithm and data structure techniques. Given the topological ordering of Algorithm X, Step 4 can be trivially implemented in parallel. It can easily be seen that Steps 1 and 4 can be handled with a linear number of processors in logarithmic time. THEOREM 4. The performance guarantee of Algorithm C Ž X, G . is at least as good as the performance guarantee of Algorithm X Ž G 2 .. Proof. Let c Ž G . be the number of two-cycles in G. Recall that G 2 is G with two-cycles removed. The effect of Algorithm C Ž X, G ., Step 4 is to add c Ž G . arcs to Aˆ2 . Furthermore, c Ž G . is the optimal number of arcs which ˆ contains no can be added to Aˆ from the c Ž G . two-cycles so that G Ž . Ž . Ž . two-cycles; hence b G s b G 2 q c G . Therefore, < Aˆ<
b Ž G.
s
< Aˆ2 < q c Ž G .
b Ž G2 . q c Ž G .
G
< Aˆ2 <
b Ž G2 .
.
Remark 2. All the algorithms in the remaining sections of this paper will take graphs without two-cycles as input since by Theorem 4, we can always pass these algorithms to Algorithm C Ž X, G . to achieve at least as good a performance guarantee for graphs that contain two-cycles.
5. RANDOMIZED ALGORITHMS Now we are ready to present an O Ž< V < q < A <.-time randomized algorithm for the maximum acyclic subgraph problem which, when given a graph G s Ž V, A. with no two-cycles, finds an Aˆ such that < Aˆ< G < A
'
'
8
BERGER AND SHOR
ness in determining a processing order, we expect to gain deg Ž ¨ . additional arcs per vertex ¨ . This gain comes from the difference between the number of arcs contributed to Aˆ and the number of arcs thrown away, when ¨ is processed. This difference can be viewed as the discrepancy between the number of incoming and outgoing arcs when a vertex is processed. The discrepancy at a particular vertex ¨ , can be modeled as a walk of length degŽ ¨ . s d out Ž ¨ . q d inŽ ¨ ., from < d out Ž ¨ . y d inŽ ¨ .< to 0, where each time a neighbor of ¨ is processed, a q1 or a y1 step is taken. The direction of each unit step of the walk is determined by whether the corresponding adjacent vertex processed was an in or out neighbor of ¨ . Note that a vertex cannot be both an in and an out neighbor since G contains no two-cycles. The walk is of length degŽ ¨ . since this is the number of neighbors of ¨ . The value of the walk at the time when ¨ is processed is the difference between the number of arcs contributed to Aˆ and the number thrown away. This walk is in fact a random walk since the neighboring vertices are processed in random order. Equivalently, we will look at the walk backward as a random walk that starts at 0 and ends at < d out Ž ¨ . y d inŽ ¨ .<. Now let us consider the random walk more closely. Let w Ž i . be the value of the random walk w after i steps. Then, w Ž0. s 0 and w Ž d . s t, where d is the length of the walk and t is the ending point of the walk. Thus, d s d out Ž ¨ . q d inŽ ¨ . and t s < d out Ž ¨ . y d inŽ ¨ .<. Algorithm RŽ G . chooses uniformly from all walks with steps of "1 that have length d, start at 0, and end at t. Since a walk is determined solely by the positions of the q1’s and y1’s, each walk is generated by exactly d in Ž ¨ .!d out Ž ¨ .! permutations of the neighbors of ¨ . Hence, Algorithm RŽ G . generates each walk with equal probability. After setting up the above formulation we can now prove the following two lemmas. Essentially, they show that when ¨ is processed, the expected difference, or discrepancy, between the number of arcs added to Aˆ and the number thrown away is V Ž'd .. The first lemma states that conditioning on the random walk ending at t gives an expected difference no worse than half that given by conditioning on ending at the origin. The second lemma proves the desired result in terms of the latter smaller expected difference. In these two lemmas we assume that d is even. Once we have the result for even d, it is easy to show that it also holds for odd d.
'
LEMMA 1. Ew < w Ž r .< < w Ž d . s t x G 12 Ew < w Ž r .< < w Ž d . s 0x for d and t e¨ en, 0 F r F d, and 0 F t F d. Proof. We choose two correlated random walks, w 1 and w 2 , of length d as follows, so that w 1 is uniformly distributed over random walks ending at
9
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
t and w 2 is distributed uniformly over random walks ending at 0. Choose w 2 uniformly such that w 2 Ž d . s 0. Construct w 1 from w 2 by choosing at random tr2 of the y1 steps in w 2 and changing them to q1 steps. Observe that w 1 is a walk ending at w 1Ž d . s t. Furthermore, w 1 is distributed uniformly among walks of length d starting at 0 and ending at t, since the same number of w 2 ’s can give rise to each w 1. Now we have the following: E < w1Ž r . < s
Ý Ý < l
w 1 Ž r . s l and w 2 Ž r . s m
m lGm
Ý Ý < l
s
w 1 Ž r . s l and w 2 Ž r . s m
mG0 lGm
Ý Ý < l
q
w 1 Ž r . s l and w 2 Ž r . s m
m-0 lGm
Ý Ý < m
G
w 1 Ž r . s l and w 2 Ž r . s m
mG0 lGm
s
Ý
< m<
mG0
s
Ý
Ý Pr
w 1 Ž r . s l and w 2 Ž r . s m
lGm
< m
mG0
s 12 E < w 2 Ž r . < , since Prw w 2 Ž r . s m x s Prw w 2 Ž r . s ym x. LEMMA 2.
Ew < w Ž r .< < w Ž d . s 0x G V Ž'd ., when d4 F r F
3d 4
.
Proof. Note that Pr w Ž r . s l < w Ž d . s 0 F Pr w Ž r . s 0 < w Ž d . s 0 since Žby the hypergeometric distribution. we can explicitly calculate the probabilities and see that dy r dyryl
r rql
dyr dyr
r r
žž //žž // žŽ ./žž // žž // žž // 2
2
d d 2
F
2
2
d d 2
.
10
BERGER AND SHOR
Also note that dy r dyr
r r
žŽ ./žž // žž // 2
Pr w Ž r . s 0 < w Ž d . s 0 s
2
d d 2
Fc
(
d rŽ d y r.
c9
F
for
'd
d 4
FrF
3d 4
.
Thus, Pr < w Ž r . < F l < w Ž d . s 0 F Ž 2 l q 1. F
1 2
if l F
c9
for
'd 'd 6 c9
d 4
FrF
3d 4
.
Therefore, E < wŽ r . < < wŽ d. s 0 G
'd 12 c9
d
for
4
FrF
3d 4
.
We will use the above two lemmas to obtain the following result. THEOREM 5.
Algorithm RŽ G . returns an Aˆ such that E < Aˆ< G
< A< 2
qV
deg Ž ¨ . .
žÝ' ¨ gV
/
Proof. Suppose that the time when ¨ is processed corresponds to the time we have taken r steps on the random walk w and that w Ž r . s l. Let d be the degree of ¨ . Let rAˆŽ ¨ . be the number of arcs contributed to Aˆ by ¨ . This is the maximum of the number of in-arcs and the number of out-arcs adjacent to ¨ when ¨ is processed. Since in- and out-arcs correspond to "1 steps, and since we are walking backward Ži.e., the ith step of w corresponds to the Ž d q 1 y i .-th neighbor of ¨ removed., rAˆŽ ¨ .
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
11
is the maximum of the number of q1 steps and the number of y1 steps in the first r steps of the random walk. With this definition, it is easy to show that rAˆŽ ¨ . s Ž r q < l <.r2. Taking expectations, we find E rAˆŽ ¨ . sE s s
r q
Ew r x 2 d 4
q
E w < l
q V Ž 'd . by Lemmas 1 and 2.
Then the total expected number of arcs in Aˆ is
Ý
¨ gV
E rAˆŽ ¨ . s s
deg Ž ¨ .
Ý
4
¨ gV
< A< 2
q
Ý
¨ gV
q
Ý
¨ gV
V
V
ž 'degŽ ¨ . /
ž 'degŽ ¨ . / .
Low degree graphs. When G is a low degree graph, we can calculate the exact expectation of the size of Aˆ returned by Algorithm RŽ G . by going through all possible cases. For example, when the degree is 2, the possible random walks of length 2 starting and ending at 0 are UD and DU Žhere U means a q1 step and D means a y1 step., both of which give a bound of Ž2rd . Ew 12 Ž r q < l <.x s 23 . To compute this expectation, we average over each of the 3 possible values for the number of steps taken in the walk, r s 0, 1, 2, plus the value of the walk itself corresponding to each possible step, l s 0, 1, 0 Žrespectively.. This gives the 23 < A < bound for degree 2 graphs, since it is easy to check Žby comparing this case with the cases UU and DD. that the walks starting at 0 and ending at 0 give the smallest bounds. When the degree is 3, the worst case is walks starting at 0 and ending at 1. These walks are UUD, UDU, and DUU. Walks UDU and DUU give a value of Ž2rd . Ew 12 Ž r q < l <.x s 23 , while walk UUD gives 56 . 13 13 < A < for 3-regular Averaging these values gives 18 , implying the bound of 18 2 graphs. This value is larger than the 3 < A < we get for degree 2 because with odd degree, the walks cannot end at 0. Hence, for arbitrary degree 3 graphs, we get 23 < A <. For degree 4, the worst case again is walks ending at 0. We need only compute walks starting with U, because the ones starting with D are symmetric. The walk UUDD gives Ž2rd . Ew 12 Ž r q < l <.x s 107 ,
12
BERGER AND SHOR
19 while walks UDUD and UDDU give 106 . The average is thus 30 , implying 19 < < 30 A for degree 4 graphs. Calculations for degree 5-regular graphs show 19 < < < < Ž that we get 33 50 A , which is larger than the 30 A we get for degree 4 again, 19 because 5 is odd., so the 30 < A < bound holds also for arbitrary degree 5 graphs.
An RNC Algorithm Algorithm RŽ G . can be easily parallelized Ži.e., shown to be in the complexity class RNC .. Suppose that we have a processor for each vertex and each arc in G, and an incoming and outgoing adjacency list in shared memory. Then, once we have assigned a randomized ordering to the vertices of G, we can process all of them in parallel. To produce a randomized ordering: randomly assign each vertex i a rank ri g 1, . . . , s 4 , s g N Žwe will discuss possible choices for s later.. When we process a vertex, we will only consider its neighbors with a higher number in the assigned ordering. We will place in the acyclic subgraph Aˆ either all the out-arcs to or all the in-arcs from the higher numbered neighbors, which ever set is larger. It can easily be seen that this procedure can be handled with a linear number of processors in logarithmic time, using standard parallel algorithm and data structure techniques.
6. A DETERMINISTIC ALGORITHM Using the results for the randomized algorithm, we are able to give an O Ž< V < < A <.-time deterministic algorithm for the maximum acyclic subgraph problem which, when given a graph G s Ž V, A. with no two-cycles, finds an Aˆ such that < Aˆ< G < A
'
For i s 1 to < V < do: 1. At the ith iteration of this loop, assume vertices labeled ¨ 1 , . . . , ¨ iy1 have already been processed in that order.
13
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
2. Choose the ¨ g V y ¨ 1 , . . . , ¨ iy 1 4
for
which
E w < Aˆ<
THEOREM 6. Algorithm DŽ G . returns an Aˆ such that < Aˆ< G < A
'
Proof. Note that Ew < Aˆ
¨ gVy ¨ 1 , . . . , ¨ iy1 4
E < Aˆ<
which must be at least as large as the average. Since at each step, Algorithm DŽ G . has at least as large an Ew < Aˆ
Ew < Aˆ<
Proof. We know how many arcs all of the processed vertices contribute ˆ For the unprocessed vertices, we can calculate exactly the expected to A. number of arcs they add to Aˆ by using the random walk formulation from above. Suppose we want to compute Ew < Aˆ<
rAˆŽ ¨ 0 .
Ý ¨ 0g ¨ 1 , . . . , ¨ iy1 , ¨ 4
q
Ý
E rAˆŽ ¨ 9 .
¨ 9gVy ¨ 1 , . . . , ¨ iy1 , ¨ 4
The first sum is easy to compute. For the second, let ¨ 9 have d out Ž ¨ 9. out-arcs into the set V y ¨ 1 , . . . , ¨ iy1 , ¨ 4 and d inŽ ¨ 9. in-arcs from the set V y ¨ 1 , . . . , ¨ iy1 , ¨ 4 . Notice that we are now using d out Ž ¨ 9. and d inŽ ¨ 9. for the out- and in-degree of ¨ 9 with respect to the subgraph of G induced by the vertex set V y ¨ 1 , . . . , ¨ iy1 , ¨ 4 , and not the original graph G. Let dŽ ¨ 9. be d out Ž ¨ 9. q d inŽ ¨ 9. and t Ž ¨ 9. be < d out Ž ¨ 9. y d inŽ ¨ 9.<. Let w be a random walk from 0 to t Ž ¨ 9. taking dŽ ¨ 9. steps and r be a variable uniformly taking integer values between 0 and dŽ ¨ 9. independent of w. Finally, let l s w Ž r . be the random variable taking the value of w at r. By the
14
BERGER AND SHOR
argument on random walks above, E rAˆŽ ¨ 9 .
r q
Ew r x 2 d Ž ¨ 9. 4
q
E w < l
q
2 E w < l
.
We can now calculate Ew < l < < w Ž d . s t x using the following equality Žwhich we argue is correct in the next paragraph.: E < l < < wŽ d. s t s
1 dq1
tq q
dqt 2 dyt 2
E < l < < w Ž d y 1. s t y 1 E < l < < w Ž d y 1. s t q 1 .
Since this expectation depends solely on the values of d and t, at the outset of the algorithm we can construct a table, table1, such that table1 w d, t x ¤ Ew < l < < w Ž d . s t x, for all 0 F t F d F D. Although this table will be used for looking up expectations for different values of d and t throughout the execution of the algorithm, the table entries corresponding to given values of d and t never change. Observe that the above equality holds by the following argument. First note that E < l < < wŽ d. s t s
1 dq1
d
Ý
E < w Ž r 9. < < w Ž d . s t ,
r 9s0
since l s w Ž r . and r is uniformly distributed between 0 and d. Two main cases arise: 1. r 9 s d: 1 dq1
E < wŽ d. < < wŽ d. s t s
1 dq1
t.
2. r 9 - d: consider two subcases. Ža. The class of walks where the last step is a q1 step. The probability that we are not sampling at r 9 s d is drŽ d q 1.. Since we are conditioning the expectation on the last step being a q1 step, we multiply by the probability of the last step being q1, which is Ž d q t .r2 d. ŽThere
15
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
are d steps, of which 12 Ž d q t . are q1 steps.. Finally, Ew < l < < w Ž d y 1. s t y 1x is the average over all walks which take a q1 step in the last step. Žb. The class of walks where the last step is a y1 step. This case is symmetric to Case 2a, although it is concerned with y1 steps rather than q1 ones. THEOREM 7. The running time of Algorithm DŽ G . is O Ž< V < < A <.. Proof. We want to be able to calculate Ew < Aˆ<
d Ž ¨ 9. 4
q
E < l < < wŽ d. s t 2
,
for all ¨ , ¨ 9 g V. At the outset of the algorithm, we initialize table2 so that table2 w ¨ , ¨ 9 x ¤ E rAˆŽ ¨ 9 .
Ý ¨ 0g ¨ 1 , . . . , ¨ iy1 , ¨ 4
rAˆŽ ¨ 0 . q
table2 w ¨ , ¨ 9 x ,
Ý ¨ 9gVy ¨ 1 , . . . , ¨ iy1 , ¨ 4
for all ¨ g V y ¨ 1 , . . . , ¨ iy14 . At the outset of the algorithm, sumw ¨ x ¤ rAˆŽ ¨ . q
Ý
table2 w ¨ , ¨ 9 x ,
¨ 9gVy ¨ 4
for all ¨ g V. This takes time O Ž< V < 2 .. At the ith step of the algorithm, we will pick the ¨ g V y ¨ 1 , . . . , ¨ iy1 4 for which sumw ¨ x is a maximum. Suppose we pick a given ¨ at step i. We must then update various entries of table2 and sum. For each ¨ 9 adjacent to ¨ and for each ¨ j g V y ¨ 1 , . . . , ¨ iy1 , ¨ 4 , we do the following: we must first update table2 w ¨ j , ¨ 9x; then, we must update sumw ¨ j x by subtracting out the old value of table2 w ¨ j , ¨ 9x, adding in the new one, and adding or subtracting a 1 depending on
16
BERGER AND SHOR
whether ¨ was a neighbor whose removal makes rAˆŽ ¨ j . grow or shrink. Over all steps of the algorithm, updating takes time O Ž< A < < V <. altogether. Since this dominates the other terms required for initialization, our proof is complete.
7. THE UPPER BOUND CONSTRUCTION Here we demonstrate the existence of a class of arbitrarily large graphs without two-cycles that have an acyclic subgraph of size at most < A
n
ž
Ý 'D is1
/
.
Now for any t G 1 construct a graph Gt s Ž Vt , A t . which is the union of t disjoint copies of the above random tournament. Then, Gt has an acyclic ' . < < ŽD. subgraph of size at most < A t
ACKNOWLEDGMENTS ´ Tardos for helpful We thank Michelangelo Grigni, David Shmoys, Joel Spencer, and Eva ´ Tardos for introducing us to the problem. We discussions on this work. We also thank Eva
TIGHT BOUNDS FOR MAX ACYCLIC SUBGRAPH
17
especially thank David S. Johnson, John Rompel, and David Shmoys for helpful critiques of drafts of this paper. We gratefully acknowledge Joel Spencer for pointing out that our initial upper bound of Ž1r2 q O Ž log D Ž G . r D Ž G . ..< A < on the size of an acyclic subgraph of a random tournament had already been improved to Ž1r2 q O Ž1r D Ž G . ..< A <.
'
'
'
REFERENCES 1. S. Arora, C. Lund, R. Motwani, M. Sudan, and M. Szegedy, Proof verification and hardness of approximation problems, in ‘‘Proceedings of the 33nd Annual Symposium on Foundations of Computer Science, IEEE, Oct. 1992,’’ pp. 14]23. 2. B. Berger, The fourth moment method, in ‘‘Proceedings of the Second Annual ACMrSIAM Symposium on Discrete Algorithms, ACMrSIAM, Jan. 1991,’’ pp. 373]383. walso SIAM J. Comput. 26, in pressx 3. B. Berger and P. W. Shor, Approximation algorithms for the maximum acyclic subgraph problem, in ‘‘Proceedings of the First Annual ACMrSIAM Symposium on Discrete Algorithms, ACMrSIAM, Jan. 1990,’’ pp. 236]243. 4. W. Fernandez de la Vega, On the maximum cardinality of a consistent set of arcs in a random tournament, J. Combin. Theory Ser. B 35 Ž1983., 328]332. 5. P. Erdos ¨ and J. Selfridge, On a combinatorial game, J. Combin. Theory Ser. A 14 Ž1973., 298]301. 6. G. Even, J. Naor, B. Schieber, and M. Sudan, Approximating minimum feedback sets and multi-cuts in directed graphs, in ‘‘Integer Programming and Combinatorial Optimization’’ ŽE. Balas and J. Clausen, Eds.., Lecture Notes in Computer Science, Vol. 920, pp. 14]28, Springer-Verlag, BerlinrNew York, 1995. 7. M. X. Goemans and D. P. Williamson, Primal-dual approximation algorithms for feedback problems in planar graphs, in ‘‘Integer Programming and Combinatorial Optimization,’’ ŽW. H. Cunningham, S. T. McCormick, and M. Queyranne, Eds.., Lecture Notes in Computer Science, No. 1084, pp. 147]161, Springer-Verlag, BerlinrNew York, 1996. 8. R. Greenlaw, The parallel complexity of approximation algorithms for the acyclic subgraph problem, Technical Report 90-61, Department of Computer Science, Univ. of New Hampshire, Durham, NH, Feb. 1990. 9. R. Karp, Reducibility among combinatorial problems, in ‘‘Complexity of Computer Computations,’’ ŽR. E. Miller and J. W. Thatcher, Eds.., Plenum Press, New York, 1975. 10. P. Klein, C. Stein, and E. Tardos, Leighton]Rao might be practical, in ‘‘Proceedings of the 22nd Annual ACM Symposium on Theory of Computing, May 1990,’’ pp. 310]321. 11. R. H. Lathrop, R. J. Hall, and Robert S. Kirk, Functional abstraction from structure in VLSI simulation models, in ‘‘Proceedings of the 24th IEEErACM Design Automation Conference, Miami Beach, FL, June 1987, IEEErACM,’’ pp. 822]828. 12. T. Leighton and S. Rao, An approximate max-flow min-cut theorem for uniform multicommodity flow problems with applications to approximation algorithms, in ‘‘Proceedings of the 29th Annual Symposium on Foundations of Computer Science, IEEE, Oct. 1988,’’ pp. 422]431. 13. J. Leung, Private communication, 1989. 14. C. H. Papadimitriou and M. Yannakakis, Optimization, approximation, and complexity classes, J. Comput. System Sci., 43Ž3. Ž1991., 425]440. 15. S. Poljak, V. Rodl, ¨ and J. Spencer, Tournament ranking with expected profit in polynomial time, SIAM J. Discrete Math., 1 Ž1988., 372]376.
18
BERGER AND SHOR
16. P. Raghavan, Probabilistic construction of deterministic algorithms: Approximating packing integer programs, J. Comput. System Sci. 37Ž4. Ž1988., 130]143. 17. V. Ramachandran, Finding a minimum feedback arc set in reducible flow graphs, J. Algorithms 9Ž3. Ž1988., 299]313. 18. S. Rao, ‘‘Finding Small Balanced Edge Cuts: Theory and Applications,’’ Ph.D. thesis, EECS, MIT, Cambridge, MA, Aug. 1989. 19. P. D. Seymour, Packing directed circuits fractionally, Combinatorica 15 Ž1995., 281]288. 20. M. H. Shirley, ‘‘Generating Circuit Tests by Exploiting Designed Behavior,’’ Technical Report MITrAIrTR-1099, MIT Artificial Intelligence Laboratory, Cambridge, MA, Dec. 1988. 21. J. Spencer, Balancing games, J. Combin. Theory Ser. B 23 Ž1977., 68]74. 22. J. Spencer, ‘‘Ten Lectures on the Probabilistic Method,’’ SIAM, Philadelphia, 1987. 23. H. Stamm, On feedback problems in planar digraphs, in ‘‘Graph-Theoretic Concepts in Computer Science,’’ ŽR. H. Mohring, Ed.., Lecture Notes in Computer Science, No. 484, ¨ pp. 79]89, Springer-Verlag, BerlinrNew York, 1990.