Journal of Mathematical Sciences, Vol. 126, No. 3, 2005
A 2|E|/4-TIME ALGORITHM FOR MAX-CUT A. S. Kulikov and S. S. Fed...
13 downloads
526 Views
144KB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
Journal of Mathematical Sciences, Vol. 126, No. 3, 2005
A 2|E|/4-TIME ALGORITHM FOR MAX-CUT A. S. Kulikov and S. S. Fedin
UDC 519.178, 510.52
In this paper, we present an exact algorithm that solves MAX-CUT in time poly(|E|) · 2|E|/4 , where |E| is the number of edges (multiple edges between two vertices are allowed). This bound improves the previously known bound poly(|E|) · 2|E|/3 of Gramm et al. (2000). Bibliography: 8 titles.
1. Introduction Exponential worst-case upper bounds for NP-hard problems. NP-hard optimization problems arise naturally in many areas of computer science. Various exponential worst-case upper bounds are known for algorithms that solve such problems. Most results in the area concentrate around SAT, the problem of satisfiability of a propositional formula in conjunctive normal form. Usually, algorithms solving SAT use the local search method or the splitting method ([3] is a good survey of these methods). MAX-CUT problem. In this paper, we consider another NP-hard problem, namely MAX-CUT. Given an undirected graph G = (V, E) (which may contain multiple edges), we ask for a cut of maximum weight, i.e., for a partition of the set of vertices V into two subsets V1 and V2 that maximizes the number of edges (u1 , u2) ∈ E for which u1 ∈ V1 and u2 ∈ V2 . This MAX-CUT problem is one of Karp’s original NP-complete problems (see [5]), and has long been known to be NP-complete. Moreover, MAX-CUT is MAX-SNP-hard (see [7]), i.e., there exists a constant c < 1 such that the existence of a c-approximation algorithm for this problem would imply that P = N P (see [1]). Besides its theoretical importance, the MAX-CUT problem has applications in circuit layout design and statistical physics (see [2]). For a comprehensive survey of the MAX-CUT problem, the reader is referred to the paper of Poljak and Tuza [6]. Worst-case upper bounds for MAX-CUT. A simple O(2nd/(d+1)) bound, where n is the number of vertices and d is the maximum vertex degree, is given in [8]. Recently Gramm et al. [4] designed an algorithm solving MAX-CUT in time O(2M/3 ), where M is the number of edges in the graph. This bound is of particular interest for graphs with a bounded degree: if d = 3, then MAX-CUT can be solved in time O(2n/2 ), and if d = 4, then MAX-CUT can be solved in time O(22n/3). In this paper, we improve the bound of [4] to O(2M/4 ). The main ideas of our algorithm. Similarly to the algorithm of [4], our algorithm is a typical splitting algorithm. Namely, it uses a procedure, called splitting procedure, which reduces the problem for a graph G to the problem for two graphs with a smaller number of edges. Before splitting each of the obtained two graphs, the algorithm may simplify them using transformation rules. The algorithm of [4] transforms an instance of MAX-CUT into an instance of MAX-2-SAT, and then solves the latter problem. While the analysis of this algorithm uses the fact that the input formula originates from a MAX-CUT instance, the algorithm itself does not make use of this fact. Unlike this algorithm, our algorithm solves MAX-CUT directly. Since those formulas in 2-CNF that correspond to graphs have a specific structure, instead of common MAX-2-SAT transformation rules, we can use rules that can be applied to these formulas only. Our algorithm works with a slight generalization of the MAX-CUT problem: to each vertex of our graph we attach two numbers ∆1 and ∆2 , where ∆i (with i ∈ {1, 2}) denotes the weight that will be added to the maximum cut if the vertex is put into the corresponding set Vi . Informally speaking, these numbers correspond to the 1-clauses of the 2-CNF formula obtained after splitting an instance of the MAX-CUT problem formulated as a formula in 2-CNF. However, though 1-clauses are not counted in the algorithm of [4], they cannot be eliminated in MAX-2-SAT (and this imposes certain restrictions on simplification rules). On the contrary, the weights ∆1 and ∆2 are not harmful and allow us to work with graphs with ∆i’s similarly to ordinary graphs. In particular, our algorithm uses a new transformation rule, which eliminates end vertices (in a graph with ∆i’s). This rule can also be formulated in terms of MAX-2-SAT: it eliminates a variable if it appears only in two 2-clauses of the Translated from Zapiski Nauchnykh Seminarov POMI, Vol. 293, 2002, pp. 129–138. Original article submitted December 8, 2002. 1200
c 2005 Springer Science+Business Media, Inc. 1072-3374/05/1263-1200
same weight (these two 2-clauses correspond to an edge) and in several 1-clauses. This rule helps us to solve the MAX-CUT problem for some special graphs. For example, we can solve the problem for the graph (with ∆i’s) in which each vertex has degree two in a polynomial time. We show that at almost every step of our algorithm, we can make a splitting corresponding to the recurrence inequality T (|E|) ≤ 2 · T (|E| − 4) + poly(|E|) for the running time (where T (|E|) denotes the maximum time that the algorithm may take for a graph with |E| edges). The only graph for which we cannot make such a splitting is a graph without multiple edges in which each vertex has precisely three neighbors. We prove that this situation cannot appear more than once on any path of the splitting tree. Organization of the paper. Our paper is organized as follows. In Sec. 2.1, we give basic definitions. In Secs. 2.2 and 2.3, we describe the initialization and splitting procedures. In Sec. 2.4, we describe the transformation rules we use. The main algorithm and its analysis are given in Sec. 2.5. 2. Our result 2.1. General setting. To represent a graph with multiple edges, we use a graph in which each edge is assigned an integer weight (thus in what follows, we assume that there is at most one edge between each pair of vertices). We denote by |F | the total weight of edges in a set F . Let W (u, v) denote the weight of the edge between vertices u and v. We denote by W (v) the total weight of edges between a vertex v and its neighbors; W (G) denotes the weight of the graph G = (V, E): W (G) = 12 v∈V W (v). We denote by Deg(v) the degree of a vertex v, i.e., the number of its neighbors. The weight of the cut determined by a partition (V1 , V2 ) of the vertex set V is the sum of the weights of those edges (u1 , u2 ) for which u1 ∈ V1 and u2 ∈ V2 . A partition (V1 , V2 ) is called optimal if it corresponds to a cut of the maximum possible weight. At the beginning of our algorithm, the sets V1 and V2 are empty. At each step, we move some vertices from V to one of the partition sets (when we remove a vertex from V , we also remove all incident edges from E). Thus some edges are added to the cut. Let CurrentCut be the variable that denotes the weight of this cut. Let ∆1 and ∆2 be integer-valued functions on the set of vertices. The intuitive meaning of these functions is as follows: ∆1 (v) (respectively, ∆2 (v)) is the number that will be added to the current value of the cut when we add v to the set V1 (respectively, V2 ). These functions help us to save the information on the weight of removed edges as follows. Assume that the graph contains vertices u and v such that (u, v) ∈ E, and at some step of our algorithm, we move v from V to V1 . In this case, we need to remember that if we move u to V2 , then the weight of the cut will be increased by W (u, v). To save this information, we change ∆2 (u) as follows: ∆2 (u) = ∆2 (u) + W (u, v). 2.2. Initialization procedure. We assume that each graph G appearing in our algorithm consists of a vertex set G.V , an edge set G.E (each edge is assigned an integer weight), a variable G.CurrentCut, and two functions G.∆1 and G.∆2 (it is clear from the description of the algorithm that 0≤ ∆1 (v), ∆2 (v) ≤ |E| at each step of the algorithm). The weight of a cut (V1 , V2 ) for such a graph is equal to (u,v)∈E,u∈V1,v∈V2 W (u, v) + u∈V1 ∆1 (u) + u∈V2 ∆2 (u). Before applying our algorithm to the graph G, we apply the following procedure: Procedure Init(Graph G) G.CurrentCut = 0 FOR each u ∈ G.V ∆1 (u) = 0, ∆2 (u) = 0 end FOR 2.3. Splitting. By means of splitting, we reduce the problem for a graph G to the problem for two graphs G[v ∈ V1 ] and G[v ∈ V2 ] (where v ∈ V ). We make splittings using the following procedure: Procedure Split(Graph G, Vertex v) FOR i = 1, 2 (a) G[v ∈ Vi ].CurrentCut = G.CurrentCut + ∆i(v) (b) G[v ∈ Vi ].E = G.E (c) G[v ∈ Vi ].V = G.V − {v} (d) FOR each u ∈ G[v ∈ Vi ] 1201
G[v ∈ Vi ].∆1(u) = G.∆1(u), G[v ∈ Vi ].∆2(u) = G.∆2(u) end FOR (e) FOR each u ∈ G.V IF (u, v) ∈ G.E G[v ∈ Vi ].∆3−i(u) = G[v ∈ Vi ].∆3−i(u) + W (u, v), G[v ∈ Vi ].E = G[v ∈ Vi ].E − {(u, v)} end IF end FOR end FOR return G[v ∈ V1 ] and G[v ∈ V2 ] In short, the splitting procedure removes the vertex v and all its edges from the graph and saves in ∆i(u) the information that if the vertices u and v belong to different partition sets, then the edge (u, v) belongs to the cut. It is obvious that M axCut(G) = max{M axCut(G[v ∈ V1 ]), M axCut(G[v ∈ V2 ])}. Note that W (G[v ∈ V1 ]) = W (G[v ∈ V2 ]) = W (G) − W (v). 2.4. Transformation rules. To obtain a cut of maximum weight, it suffices to consider all cuts and choose the optimal one from them. Thus for every vertex v, we must consider two cases: v ∈ V1 and v ∈ V2 . But in some cases, we can prove that in at least one optimal partition a certain vertex belongs to one of these sets. In this situation, we do not need to consider the case where this vertex belongs to the other set. Transformation rules help us to handle such vertices. A correct transformation rule replaces a graph G with a simpler graph G such that M axCut(G)=M axCut(G), i.e., a correct transformation rule preserves the weight of a maximum cut. Each transformation rule takes a polynomial time and does not increase the total weight of edges. We now list the transformation rules that we use in our algorithm and prove their correctness. Rule 1: Guaranteed value. This rule changes the graph as follows: FOR each u ∈ G.V G.CurrentCut = G.CurrentCut + min{∆1 (u), ∆2 (u)} G.∆1(u) = G.∆1(u) − min{∆1 (u), ∆2 (u)} G.∆2(u) = G.∆2(u) − min{∆1 (u), ∆2 (u)} end FOR Lemma 1. Rule 1 is correct. Proof. Note that in a leaf of the splitting tree, each vertex must belong to precisely one of the sets V1 or V2 . Thus when a vertex v is added to one of the partition sets, at least min{∆1 (v), ∆2 (v)} is added to the variable CurrentCut. Rule 2: Isolated vertex. If the graph contains a vertex v of weight 0, then Rule 2 changes the graph as follows: G.V = G.V − {v}, G.CurrentCut = G.CurrentCut + max{∆1 (v), ∆2 (v)}. Clearly, this rule is correct. Rule 3: End vertex. Assume that G contains vertices v and u such that (u, v) ∈ E and Deg(v) = 1. Note that at least one of the functions ∆1 (v) and ∆2 (v) is equal to 0 (otherwise apply Rule 1). Assume without loss of generality that ∆2 (v) = 0. Let us first assume that ∆1 (v) ≥ W (u, v). Then Rule 3 changes the graph as follows: ∆2 (u) = ∆2 (u) + W (u, v), CurrentCut = CurrentCut + ∆1 (v), E = E − {(u, v)}, V = V − {v}. Now assume that ∆1 (v) < W (u, v). Then Rule 3 changes the graph as follows: ∆2 (u) = ∆2 (u) + ∆1 (v), CurrentCut = CurrentCut + W (u, v), E = E − {(u, v)}, V = V − {v}. Lemma 2. Rule 3 is correct. Proof. Consider the case ∆1 (v) ≥ W (u, v). Assume that in some optimal partition, v ∈ V2 . Then move v from V2 to V1 . Clearly, this does not decrease the weight of the cut. Thus the resulting partition is optimal too. This means that we do not need to consider the case v ∈ V2 . Thus we just save in the graph the information that the edge (v, u) will be added to the cut if u ∈ V2 . Then we add ∆1 (v) to CurrentCut and remove v from the graph. Now assume that ∆1 (v) < W (u, v). Note that if there exists an optimal partition in which u and v belong to the same set Vi , then moving v from Vi to V3−i increases the weight of the cut. Hence every optimal cut includes the edge (u, v). Thus we save the information that if in an optimal partition, the vertex u belongs to V2 , 1202
then v will be in V1 , and hence ∆1 (v) will be added to CurrentCut. After that we add W (u, v) to the variable CurrentCut and remove v from the graph. Rule 4: Small connected component. We can easily find an optimal cut for a small (say, with at most four edges) connected component of the graph G. Thus Rule 4 removes such a component from G and adds the weight of a maximum cut for this component to G.CurrentCut. 2.5. The algorithm. In this section, we present Algorithm MaxCut, which solves MAX-CUT in time poly(|E|)· 2|E|/4 , where |E| is the total weight of edges of the input graph. First we present the algorithm and then show its correctness and estimate its running time. Algorithm MaxCut Input: A graph G after applying Procedure Init. Output: The weight of a maximum cut of G. Method 1. Apply Rules 1–4 to G while at least one of them is applicable. 2. If G does not contain any edges, then return CurrentCut. 3. If G contains a nontrivial connected component G1 , then return M axCut(G1) + M axCut(G − G1 ). 4. If there is a vertex v of weight at least four, then return1 max{M axCut(G[v ∈ V1 ]), M axCut(G[v ∈ V2 ])}. 5. If there are vertices u and v such that W (u, v) = 2, then return max{M axCut(G1), M axCut(G2)}, where G1 and G2 are the graphs resulting from the graphs G[v ∈ V1 ] and G[v ∈ V2 ], respectively, after applying the transformation rules. 6. If each vertex has degree two, then choose any vertex v and return max{M axCut(G1), M axCut(G2)}, where G1 and G2 are the graphs resulting from the graphs G[v ∈ V1 ] and G[v ∈ V2 ], respectively, after applying the transformation rules. 7. If there are vertices u and v such that Deg(v) = 3, Deg(u) = 2, and (u, v) ∈ G.E, then return max{M axCut(G1), M axCut(G2)}, where G1 and G2 are the graphs resulting from the graphs G[v ∈ V1 ] and G[v ∈ V2 ], respectively, after applying the transformation rules. 8. If each vertex has degree three and each edge has weight one, then return max{M axCut(G[v ∈ V1 ]), M axCut(G[v ∈ V2 ])} for an arbitrary vertex v. Theorem 1. Given an undirected graph G = (V, E) in which edges are assigned integer weights, Algorithm MaxCut finds the weight of a maximum cut of G in time poly(|E|) · 2|E|/4, where |E| is the total weight of edges of G. Proof. Correctness. The correctness of the transformation rules is shown in Sec. 2.4. The correctness of the steps of Algorithm MaxCut is trivial. Let us show that every possible graph after applying the transformation rules satisfies one of the conditions of steps 2–8. Assume that the graph G does not satisfy the conditions of steps 2–7. Then G is connected. It does not contain edges of weight at least three, because it contains no vertices of weight at least four and no end vertices. Moreover, G does not contain edges of weight two, because it does not satisfy the condition of step 5. Thus each edge of the graph G has weight one, and each vertex has degree either two or three. If all vertices have degree two, then G satisfies the condition of step 6. If G contains vertices both of degree two and three, then it must contain two vertices u and v such that Deg(u) = 2, Deg(v) = 3, and (u, v) ∈ E (since G is connected). In this case, G satisfies the condition of step 7. Thus each vertex has degree precisely three. This means that the graph G satisfies the condition of step 8. Running time. After applying the transformation rules to the graph G, Algorithm MaxCut makes two recursive calls for graphs with a smaller total weight of edges (unless G becomes trivial) at one of the steps 3–8. Clearly, the total running time of the algorithm is the total running time of the two recursive calls plus the time spent to make these calls. Therefore the running time is within a polynomial factor of the number of nodes (or leaves) of the recursion tree. Now let us show that at steps 3–7, we can make a recursive call for graphs G1 and G2 such that |G.E|−|G1.E| ≥ 4 and |G.E| − |G2 .E| ≥ 4 (this corresponds to the recurrence inequality L(|E|) ≤ 2 · L(|E| − 4) on the number of leaves in the splitting tree, where L(m) denotes the maximum number of leaves in the splitting tree for the graph with m edges constructed by algorithm MaxCut). This assertion is trivial for steps 3 and 4. If G satisfies 1 In
what follows, by G[v ∈ V1 ] and G[v ∈ V2 ] we denote the graphs constructed by Procedure Split. 1203
the conditions of steps 5 or 7, then W (v) = 3 in the graph G (since G contains no vertices of weight at least four and no end vertices) and W (u) = 1 in the graphs G[v ∈ V1 ] and G[v ∈ V2 ] (i.e., u is an end vertex and Rule 2 removes it from these graphs). Thus for both graphs G1 and G2 resulting from the graph G at steps 5 or 7, |Gi.E| = |G.E|−4 (where i = 1, 2), and the inequality on the running time is satisfied. If G satisfies the condition of step 6, then the vertices of the graph form a cycle. Thus after splitting we can remove all other vertices of this cycle using Rule 2. Now let us prove that if G satisfies the condition of step 8 and does not satisfy the conditions of all other steps, then all subsequent graphs will not satisfy this condition. Assume that each vertex of the graph G has degree three and after executing some transformation rules and steps of our algorithm, G is transformed into a graph G1 satisfying the same condition. Note that neither the transformation rules nor the steps of our algorithm increase the degree of any vertex. Hence G1 .V was a connected component in G, but this contradicts the fact that G was connected. As we have shown above, each branch of the splitting tree contains at most one graph satisfying the condition of step 8. Therefore the number of leaves is O(2|E|/4 ). Remark. It is clear that the polynomial factor appearing in the running time of our algorithm is linear in the unit-cost RAM model, and is a low degree polynomial in any other reasonable model of computation. Acknowledgements. The authors thank E. A. Hirsch for bringing the problem to their attention and for valuable remarks. Numerous comments of the anonymous referees also greatly improved the readability of the paper. This paper was supported in part by grant No. 1 of the 6th RAS contest-expertise of young scientific projects (1999). Translated by the authors. REFERENCES 1. S. Arora, C. Lund, R. Motwani, M. Sudan, and M. Szegedy, “Proof verification and hardness of approximation problems,” in: Proceedings of the 33rd Annual IEEE Symposium on Foundations of Computer Science (1992), pp. 14–23. 2. F. Barahona, M. Grotschel, M. J¨ unger, and G. Reinelt, “An application of combinatorial optimization to statistical physics and circuit layout design,” Oper. Res., 36, 493–513 (1988). 3. E. Ya. Dantsin, E. A. Hirsch, S. V. Ivanov, and M. A. Vsemirnov, “Algorithms for SAT and upper bounds on their complexity,” Zap. Nauchn. Semin. POMI, 277, 14–46 (2001). 4. J. Gramm, E. A. Hirsch, R. Niedermeier, and P. Rossmanith, “New worst-case upper bounds for MAX-2SAT with application to MAX-CUT,” Technical Report 00-037, Electronic Colloquium on Computational Complexity (2000). 5. R. M. Karp, “Reducibility among combinatorial problems,” in: Complexity of Computations, R. Miller and J. Thatcher (eds.), Plenum Press, New York (1972), pp. 85–103. 6. S. Poljak and Z. Tuza, “Maximum cuts and large bipartite subgraphs,” DIMACS Ser. Discrete Math. Theor. Comput. Sci., 20, 181–244 (1995). 7. C. H. Papadimitriou and M. Yannakakis, “Optimization, approximation, and complexity classes,” J. Comput. Sys. Sci., 43, 425–440 (1991). 8. U. Zwick, personal communication to the authors of [4] (2000).
1204