SOME S I M P L I F I E D N P - C O M P L E T E PROBLEMS by M. R. G a r e y and D. S. Johnson Bell Laboratories M u r r a y Hill, New Jersey and L. Stockmeyer t M a s s a c h u s e t t s Institute of T e c h n o l o g y Cambridge, M a s s a c h u s e t t s kBSTRACT c o m b i n a t o r i a l problems, form a class, the N P - c o m p l e t e * problems, no m e m b e r of w h i c h is k n o w n to have a p o l y n o m i a l time algorithm, but such that if any one of the problems does h a v e such an algorithm, then they all do. It is w i d e l y b e l i e v e d that showing a p r o b l e m to be N P - c o m p l e t e is tantamount to p r o v i n g its c o m p u t a t i o n a l intractability. In this paper we show that a number of N P - c o m p l e t e problems remain N P - c o m p l e t e even w h e n their domains are s u b s t a n t i a l l y restricted. First we show the completeness of SIMPLE MAX CUT (MAX CUT w i t h edge weights r e s t r i c t e d to value i), and, as a corollary, the comp l e t e n e s s of the OPTIMAL LINEAR A R R A N G E M E N T problem. We then show that even if the domains of the NODE COVER and D I R E C T E D H A M I L T O N I A N PATH problems are r e s t r i c t e d to p l a n a r graphs, the two problems remain NP-complete, and that these and other graph problems remain N P - c o m p l e t e even w h e n their domains are restricted to graphs w i t h low node degrees. For GRAPH 3-COLORABILITY, NODE COVER, and U N D I R E C T E D H A M I L T O N I A N CIRCUIT, we determine e s s e n t i a l l y the lowest possible upper bounds on node degree for w h i c h the problems remain NP-complete. These results have stimulated many researchers to examine other c o m b i n a t o r i a l problems for w h i c h no p o l y n o m i a l time a l g o r i t h m s are known, to determine w h e t h e r they too are NP-complete, and their efforts have resulted in the d i s c o v e r y of a d d i t i o n a l members of this class [Sa72, Se73,U73]. Such results have considerable p r a c t i c a l significance. If one knows that t h e p r o b l e m he wishes to solve is NPcomplete, and thus is u n l i k e l y to have any p o l y n o m i a l time algorithm, he may feel justified in c o n c e n t r a t i n g on more hopeful a l t e r n a t i v e approaches. He can look for algorithms which, a l t h o u g h a d m i t t e d l y e x p o n e n t i a l in the worst case, seem to w o r k q u i c k l y on most p r a c t i c a l p r o b l e m s [K70,L73], or even w h i c h are just "less exponential" than previous algorfthms, and hence extend somewhat the m a x i m u m size p r o b l e m w h i c h can be solved w i t h i n p r a c t i c a l time limits [Sa73]. A l t e r n a t i v e l y , he can look for fast algorithms which, a l t h o u g h they do not a c t u a l l y find optimal solutions for the problem, are guaranteed to yield solutions w h i c h are "close" to optimal [Ga72,Gr72, Jo72, Jo73 ] . INTRODUCTION Certain c o m b i n a t o r i a l problems, such as the traveling salesman p r o b l e m and theorem p r o v i n g in the p r o p o s i t i o n a l calculus, have long b e e n notorious for their c o m p u t a t i o n a l intractability, in that, despite the effort of m a n y clever people, no algorithms have been found for them w h i c h can be g u a r a n t e e d to require time b o u n d e d by a p o l y n o m i a l in the length of the input. The belief in the inherent d i f f i c u l t y of these problems has b e e n strengthened by results of Cook and Karp [C71,K72]. These show that simple forms of the above problems, together w i t h a wide variety of other A third approach, w h i c h m o t i v a t e s this paper, relates to the fact that the practical s i t u a t i o n of concern often imposes a d d i t i o n a l restrictions on the domain of the problem, w h i c h may or may not make the p r o b l e m easier to solve. We examine "polynomial complete" problems, t e r m i n o l o g y of Karp [K72]. The w o r k of this author was done, in part, at Project MAC, and supported by The N a t i o n a l Science F o u n d a t i o n u n d e r research grant GJ-34671. 47 in the integers into strings of O's and l's omitted). Our proofs can then consist of showing that k n o w n N P - c o m p l e t e languages reduce to the ones we are considering. (A list of the k n o w n N P - c o m plete languages we shall use, together w i t h their definitions, is given in the Appendix). In general, we leave to the reader the s t r a i g h t f o r w a r d v e r i f i c a t i o n that (a) the language is in NP and (b) the d e s c r i b e d m a p p i n g can be p e r f o r m e d in p o l y n o m i a l time. I. SIMPLE MAX CUT A N D R E L A T E D P R O B L E M S certain n a t u r a l restrictions on the domains of a number of known N P - c o m p l e t e problems, to d e t e r m i n e w h e t h e r the resultant subproblems are still NP-complete, or if they do have p o l y n o m i a l time algorithms. Our results indicate that many k n o w n NPcomplete p r o b l e m s remain NP-complete, even w h e n their domains are s u b s t a n t i a l l y restricted. In a d d i t i o n to the immediate s i g n i f i c a n c e of k n o w i n g that these restricted p r o b l e m s are NP-complete, the nature of the r e s t r i c t i o n s makes the comp l e t e n e s s results useful in two other ways. First, they increase our knowledge of the e s s e n t i a l elements w h i c h made the o r i g i n a l p r o b l e m s NP-complete. Second, they give us valuable tools for p r o v i n g other c o m p l e t e n e s s results. For instance, by o b s e r v i n g that SATISFIA B I L I T Y W I T H AT M O S T 3 L I T E R A L S FER CLAUSE, a r e s t r i c t e d form of SATISFIABILITY, is still NP-complete, Karp [K72] was able to derive the N P - c o m p l e t e ness of C H R O M A T I C NUMBER, EXACT COVER, MAX CUT, and a n u m b e r of other problems. In [K72], the f o l l o w i n g p r o b l e m was to be NP-complete: shown MAX CUT ~ : G r a p h t G = (N,A), w e i g h t i n g f u n c t i o n w: A ~ Z, p o s i t i v e integer W. PROPERTY: There is a set S C N such that w(lu,vl) ~ w. [u,v]~A ucS,veN-S In the first half of this paper, we show that an important r e s t r i c t e d version of MAX CUT is still NP-complete, and from that derive the completeness of the (until now) i n t r a n s i g e n t O P T I M A L LINEAR A R R A N G E M E N T problem, as well as a number of more closely related problems. The second hail of the p a p e r considers the effect of r e s t r i c t i n g the allowable types of graphs for N P - c o m p l e t e graph p r o b l e m s such as NODE COVER, C H R O M A T I C NUMBER, and H A M I L T O N I A N CIRCUIT, by either restricting the m a x i m u m degree of the nodes, or a l l o w i n g only p l a n a r graphs, or both. Karp p r o v e d the N P - c o m p l e t e n e s s of this p r o b l e m by a r e d u c t i o n from the P A R T I T I O N problem. Thus, his p r o o f relies on the fact that the edge w e i g h t s can be represented in space p r o p o r t i o n a l to the loga r i t h m of their magnitudes, since there is a dynamic p r o g r a m m i n g a l g o r i t h m for P A R T I T I O N w h i c h runs in time p o l y n o m i a l in the input length, if those inputs are e x p r e s s e d in u n a r y (i.e., in length prop o r t i o n a l to their magnitudes). One might conjecture, therefore, that if we r e s t r i c t e d MAX CUT by r e q u i r i n g each edge w e i g h t to be exactly i, the new problem, w h i c h we call SIMPLE MAX CUT, might become easy. As added support for this view, notice that if W = IAI, then this p r o b l e m simply asks w h e t h e r G is bipartite, w h i c h can be d e t e r m i n e d quite easily. We summarize here the basic definitions, r e f e r r i n g the reader to [K72] for a more complete discussion. Let B = [0,i] and let B* denote the set of all finite strings of elements from B. Any subset L of B* is called a language. Let ~ be the class of functions f:B* ~ B * w h i c h are computable in p o l y n o m i a l time by onetape d e t e r m i n i s t i c T u r i n g machines. If L and M are languages, we say that L is p o l y n o m i a l reducible to M, w r i t t e n L ~ M, w h e n there is a f u n c t i o n f¢~ such that f(x)~M if and only if xeL. M is NPcomplete if M e N P (the class of languages r e c o g n i z a b l e in p o l y n o m i a l time by onetape n o n d e t e r m i n i s t i c T u r i n g machines) and every language in NP is p o l y n o m i a l reducible to M. In fact, if L is NPcomplete and L ~ M, then M e N P implies that M is NP-complete. In fact, however, SIMPLE MAX CUT is NP-complete, as we show u s i n g a two-step r e d u c t i o n from S A T I S F I A B I L ! T Y W I T H AT M O S T 3 L I T E R A L S PER CLAUSE (SAT3-- for formal definition, see the Appendix). We first c o n s i d e r the f o l l o w i n g r e s t r i c t e d version of the M A X I M U M S A T I S F I A B I L I T Y p r o b l e m of [JOY3]: M A X I M U M S A T I S F I A B I L I T Y W I T H AT MOST 2 L I T E R A L S PER CLAUSE INPUT: D i s j u n c t i v e clauses C~,C~, .... Cp, each c o n t a i n i n g at mo~t ~wo literals, p o s i t i v e integer k. PROPERTY: There is a truth a s s i g n m e n t to the variables w h i c h satisfies k or more clauses. In accord w i t h the above definitions, the "problems" we shall consider in this paper, a l t h o u g h m a n y are more n a t u r a l l y thought of as o p t i m i z a t i o n problems, shall be p r e s e n t e d as r e c o g n i t i o n p r o b l e m s (with the s t r a i g h t f o r w a r d details of the e n c o d i n g of entities such as graphs and We use the ordered pair (N,A) to denote a graph G h a v i n g node set N and edge set A. 48 We use the a b b r e v i a t i o n MAX SAT2 to denote this problem. Observe that, when k:p, this p r o b l e m can be solved in polynomial time [Co71]. However, we now show that SAT3 can be reduced to MAX SAT2, proving that MAX SAT2 is NP-complete. Theorem I.i: SAT 3 ~ MAX SAT2 N = [Ti:O<i<3p] <9 [Fi:O!i£3p] %) [tij:l!i<_n,O<j<3P] <* [fij:lii<_n,OiJi3P] k) [xi:l!i<_n] k~ [xi:l!i<_n]. Proof. Suppose we are given an input for SAT~, that is, a set S of disjunctive clauses, each containing at most 3 literals. If any clause has fewer than 3 literals, we may replace it by an equivalent clause which has exactly 3 literals merely by repeating one of the literals w h i c h it contains. Hence, we may assume that each clause in S contains exactly 3 literals, and we label them (alVblVCl) through ( a v b ~ c ~ . . . .a varmao~e r~bi~ where e~ch ai,bi, andci represents either or its negation. The corresponding set S r of clauses and value k forMAX SAT2 are given by : S' : ~ [(ai), (bi), (°i), (di), i=i (a,ivbi), (aivci), (bi,,~i) , (air'i), (bivdi), (ci~d i) ], k : 7m. 7m or more of the clauses in S' can be satisfied s i m u l t a n e o u s l y if and only if the original set S is satisfiable. For note that, if we have any satisfying assignment for S, then either one, two, or three of ai,bi,ci must be set true for each i. The reader may verify that, in all three cases, there is a truth setting for d i causing p r e c i s e l y seven of the clauses in S' arising from clause i to be satisfied. Furthermore, no setting of d. will permit more than seven m of the ten clauses to be satisfied, ~nd at most six of the clauses can be satisfied if all of a i, bi, and c i are "false. " • The basic framework A I of edges is A 1 : [[Ti,Fj]:Oiii3p,0<Ji3P] [[tij,fij]:l<i<_n,O<j<3P] k9 [(xi,fij]:l!i<_n,O!j!3P] [[xi,tij]:l~i<_n,O<j<3P]" For any given partition N = S I ~ S 2, S I ~ S~ = ~, we will say that edge [u,v] is "ha~" if both u and v belong t~ the,, same set in the partition and is go~a otherwise. Notice that all edges in A 1 will be good for any partition N : S I ~ S 2 which obeys (a) all T~ belong to the same set in the partition ~nd all F i belong to the other set, and (b) for each i, x i and all ti~ belong to the same set in the partition ~nd x~i and all f-. • ' i O belong to the other set. Furthermore, if any pair F$,F. belong to different sets in the partitmon~ then at least 3p+l edges from A I will be bad, since each such pair of nodes are mutually adjacent to 3p+l other nodes. Similarly, if any pair xi,~ i belong to the same set in the partitlon, then at least 3p+l edges from A~ will be bad, since there are_3p+l disjoint 3-edge paths between x i and x i. The following additional included in G: A 2 = ([ai,bi]:l~i<p We now prove the completeness of SIMPLE MAX CUT by reducing MAX SAT2 to it. Theorem 1.2: MAX SAT2 ~ SIMPLE MAX CUT. edges are and a i ~ b i] [[ai,F2i_l]:l<i<P] tO [[bi,F2i]:l<i<P]. Proof: Let clauses CI,C2,...,C and ~-~er k be given as input forPMAX SAT2. In analogy with the proof of Theorem i, we may assume that each clause contains exactly two literals, not necessarily distinct, and label them as (a l~bl) , !a2~b2) ..... ( ~ n bp )r a We shall cons~ruc~ a correspon g g p , as input to SIMPLE MAX CUT, in two steps, first giving the nodes and a basic framework of edges, and then adding in some additional p r o b l e m - s p e c i f i c edges. Let Xl,Xg, ....,x n be the variables occurring (either complemented or uncomplemented) in the p clauses. The set N of nodes for the graph G is The input for SIMPLE MAX CUT is the graph G = ( N , A I k O A 2 ) and W =IA I] + 2k. Given a truth assignment for the n variables which satisfies k or more clauses, construct the p a r t i t i o n N = S l < 9 S 2 as follows: S I : [Fi:O!i£3p] <3 [xi:x i is false,l<i<n] [tij:x i is false, l<i<n, OiJi3P] [xi:xi is true,l<i<n] S2 = N - SI . 49 (fij:xi is true, l!i<n, O!j!3P], Since, for each satisfied clause, one or b o t h of a. and b~ b e l o n g to S~, exactly two edges in A~ a r i s z n g from ~hat clause must be good. -Furthermore, by our previous comments every edge in A I is good. Thus we have a~ least W = I A I I + 2k good edges. is positive, b o t h S I and S 2 are nonempty. Let j = n -ISll. Form , , S~ = S ~ < ) [ul,u o ..... u.] and S^ = N' - S I. r n T~en N = S~<-) ~ is a J p a r t i t i ~ n for G' w i t h 14j = I~21 : ~, u I c S~, Un ~ S~, and I I I[[u,v]¢A':u~SI,VCS2]I Now, suppose we have a p a r t i t i o n N = S I ~ S 2 for w h i c h W or more edges are good. Since k > 0 and IAoI < 3P, the n u m b e r of bad edges cannoZ e~ceed 3P. By our previous discussion, this implies that all the F. must belong to the same set, say S~. ~or the same reason, e x a c t l y on~ of each pair xi,~ i must belong to S I. Thus, a consistent truth a s s i g n m e n ~ is obtained by setting x i "true" if and only if x~ belongs to S~ For this truth assignment, clause i is satisfied w h e n e v e r a~ or b i or b o t h b e l o n g to S 2. HowevSr, it is not difficult to see that, of the edges in A 2 a r i s i n g from clause i, e x a c t l y two are good if one or both of a. and b i b e l o n g to S 2 and none are good ~f a~ and b~ b o t h b e l o n g to S I. Therefor@, sinc@ at least 2k edges from A 2 must be good, this truth a s s i g n m e n t must satisfy at least k c l a u s e s . ~ = n 2 -l[[u,v]6A':ucS~,v¢So]l : n 2 - l[[u,v]~A:UCSl,V¢S2]l < n 2 -W :W'. Ngw, suppose there i9 a p a r t i t i o n N' = $7 k9 S~,, w i t h u~ e S~, u n ~ $2, and IS~II = I~-I = n,sdch, t~at I[[u,v]c~':ucST,vcSo]I < n 2 - W = W'. Then N : S~ <9~S~, ~ h e r ~ S~ : S~ (-l N and S o = S~(-~ ~, isma p a r t i t i S n fo~ G satisfying l[[u,v]eA:UeSl,VeS2]l =l Cu,vlZA,:uS;,vS;l, I I = n 2 - l[[u,v]~A' :UCSl,VCS2] I n 2 - (n2-W) = W. Thus G has a cut of w e i g h t greater than or equal to W if and only if G' has a cut w i t h w e i g h t not e x c e e d i n g W', w h i c h separates u I and u and divides the nodes of the grap~ into ~wo equal sized subsets. The r e d u c t i o n is p r o v e d . | An easy c o r o l l a r y to the completeness of SIMPLE MAX CUT concerns the f o l l o w i n g problem: M I N I M U M CUT INTO E Q U A L - S I Z E D SUBSETS INPUT: Graph G : (N,A), two distinguished nodes s and t, positive integer W. PROPERTY: There is a p a r t i t i o n N = $ 7 < 2 S 2 w i t h Slgh S 2 = I Sll = ~ S I, scaT, tgSo, and A u s e f u l r e s t a t e m e n t of SIMPLE MAX CUT is: MINIMUM EDGE-DELETION BIPARTITE SUBGRAPH Observe that this p r o b l e m can be solved in p o l y n o m i a l time if no r e s t r i c t i o n is made as to the sizes of the subsets [K72]. However, as defined, the p r o b l e m is NP-complete, as we can conclude from the completeness of SIMPLE MAX CUT and the following: That the f o l l o w i n g n o d e - d e l e t i o n version of this p r o b l e m is also N P - c o m p l e t e follows from T h e o r e m 1.4 below. MINIMUM NODE-DELETION BIPARTITE SUBGRAPH INPUT: Graph G = (N,A), p o s i t i v e integer k. PROPERTY: G has a b i p a r t i t e s u b g r a p h formed by d e l e t i n g k or fewer edges. l![u,v]~:UCSl,~s2]l ~ w. INPUT: G r a p h G = (N,A), p o s i t i v e integer k. PROPERTY: G has a b i p a r t i t e s u b g r a p h formed by d e l e t i n g k or fewer nodes. T h e o r e m 1.3: SIMPLE MAX CUT a M I N I M U M ~ A L - Z I Z E D SUBSETS Proof. Given a graph G = (N,A) and posimZi-V~--integer W, as input for SIMPLE MAX CUT, let n =IN'I and U = [Ul,U 2 ..... Un] satisfy U(-h N = ~. The c o r r e s p o n d i n g input for M I N I M U M CUT INTO E Q U A L - S I Z E D SUBSETS is the graph G r = (Nt,A'), nodes u l and u_, and p o s i t i v e integer W ~, define~ as fo~lows: N t = N QDU; At = [ [u, v] :u, vcN ~ and W t = n 2 - T h e o r e m 1.4: CLIQUE ~ M I N I M U M NODED E L E T I O N B I P A R T I T E SUBGRAPH. Proof: Given a graph G = (N,A) and p o s - ~ i v e integer j as input to CLIQUE (for a formal d e f i n i t i o n of CLIQUE See the Appendix), let n = INI and U = [u 1 ,u2,.'''.,u n ] where U(~ N = ~ The c o r r e s p o n d m n g input for M I N I M U M NODED E L E T I O N B I P A R T I T E S U B G R A P H is the g r a p h G, = (N',A') and integer k defined as follows: N' = N tJU; A' : ( [ u , v ] : u , v ~ N ' , f u , v ] 6 A , and [u,v] ~ A]; W. Ifu,v]gh ul < i]; Suppose there is a p a r t i t i o n N = S L-) S that l[[u,v]cA:U~Sl,V~S2]l ~ W. Since W 2 k = n - j. 50 The reader may verify that G contains a clique of j nodes if and only if G' has a bipartite subgraph formed by deleting n-j or fewer n o d e s . | The final result of this section concerns the OPTIMAL LINEAR ARRANGEMENT problem [A73], defined as follows: OPTIMAL If(u)-f(~)l : {U, v}[A' If (u)-f(~)l LINEAR ARRANGEMENT INPUT: Graph G = (N,A), weighting function w:A ~ Z , positive integer W. PROPERTY: There is a i-i function f:N ~ Z such that w({u,v]). If(u)-f(v)l i = 3 W. < < nS+n+lh - This problem is a special case of the well-known quadratic assignment problem and a number of related facility location and component placement problems. We use a reduction from SIMPLE MAX CUT to show that this problem is NP-complete, even in the restricted case where all edge weights are required to be i (which we call SIMPLE OPTIMAL LINEAR ARRANGEMENT). Theorem 1.5: ~ A R / _ V If(u)-f(~)l {u,~}~A (u,v]~A 3 Now s u p p o s e t h e r e e x i s t s f:N'---~Z such that ~ y _kn ~ = w. a 1-1 function Jf(u)-f(v)l < W. Then there exists such an f having range [i 2 n~+n]. Let F denote the set of ±-{ ~ d ~ i o n s f:~,' ~ [1,2 ..... n'+nl. Observe that for any f[F SIMPLE MAX CUT ~ SIMPLE ARRANGEMENT Proof: Given a graph G = (N,A) and pos--~ive integer k as inpu~ for SIMPLE MAX CUT, let n = INI, r = n-, and U = fuq,u o .... ,Ur] where U ~ N = ~. The corresDonding input for SIMPLE OPTIMAL LINEAR ARRANGEMENT is the graph G' = (N',A ' ) and positive integer W defined as follows: N' h -~ : ( n~+n+l 3 Z If(u)-f(v)l + )~ If(u)-f(v)q [u,vI~A/ [u,v]~A' l<_i<j~<__~n~+n'J-i1: ~ \ 3 /" = N <J U; there There fore, A' : [[u,v]:u,v~N' and exists an fcF such that [u,v]6A]; ~' If(u)-f(v) I > kn 4 (u,,,T]~A Define (Notice th;t-(t~: >-] (v-u) which l<u<v<t the minimum W achievable--for graph on t nodes.) is W* = max f~F a complete (u)-f(v) I 'qf /, [U,V]cA and Suppose we have a partition N : SItN which satisfies l[[u,v]~A:u~Sl,v~S~]1%2k. Let S~ = [al,a 2 ..... at] and ~ ~ -S o = ~bq,b o ..... b t]. Define f as fbllows? n-_ F* = IfcF: £ If(u)-f(v)l = W* I " [u,v]~A Clearly W* > kn 4 and F* is nonempty. each f~F*, ~efine the set f(ai) = i, 1 < i < t f(ui) = t + i, 1 <_ i <_ n f(bi) : n ~4 + t + i, 1 <_ i <_ n - t. For 4 S(f) : [vcN:zui,uj~U with f(ui) < f(v) < f(uj)] and let m(f) : I S (f)l. Then there exists a function g~F* such that m(g) < m(f) for all fcF*. We first show that m~g) : O. 51 Suppose m(g) > O. Let v eS(g) be such that g(v~) > g(v) for alY yeS(g). For each yen w, ~efine L(v) = l[ueN':[u,v]¢A + 2, I g(u)-g(v) 1 (u,v]cA ue S I , ve S 2 and g(u)<g(v)] I and < R(v) = l~ueN':[u,v]eA ~ W* and m ( g ) < m ( g ) veS2]l n3 n3 n3 < -~- + -6- + - ~ + n 4.1 [[u,v]eA:neSl,VeS2]l which, This which ~(Vl) : g(v 2) and ~(v2) : g(vl), satisfies [u,v[cA :W @ , of W*. = O. Since m(g) = O, the elements of U are mapped by g to a set of consecutive integers. Define a p a r t i t i o n N = SIk3S 2 by S I = [vcN:g(v)<g(u) for all ueU], S 2 : [veN:g(v)>g(u) for all ueU]. v~ ~ Graph Problems ~ Ig (u)-g(v) I [u,v]~A L,,, the proof of Theorem 1.5. More interesting are the cases where the answer is not readily apparent. For instance, it is implicit in the l i t e r a t u ~ that MAX CUT, when restricted to planar raphs, can be solved in polynomial time. 072] presents a polynomial time procedure for reducing the p r o b l e m of finding the m a x i m u m cut in a w e i g h t e d planar graph to that of finding a m i n i m u m w e i g h t e d m a t c h i n g in a complete graph derived from the dual of the original graph. A l t h o u g h [072] then resorts to a n o n - p o l y n o m i a l branch and bound technique, the w e i g h t e d matching can be found in p o l y n o m i a l time using a method of Edmonds [E70]. We now have kn 4 < I ~ k. In certain eases, we can observe trivially that it is. For example, consider the p r o b l e m CLIQUE [K72]. Since the largest clique possible in a planar graph has size 4, and the largest clique possible in a graph w i t h m a x i m u m node degree k has size k + i, we can find the largest clique in either case in p o l y n o m i a l time by examining all subsets of 5 or fewer (k+l or fewer) nodes~ in time p r o p o r t i o n a l to at most n ~ or n K+±, respectively. g(u)-g(v)l (u,v]~A c o n t r a d i c t i n g the definition Therefore, we must have m(g) implies M a n y of the reductions w h i c h were first used to show certain graph theoretic problems to be NP-complete involved the c o n s t r u c t i o n of rather complicated graphs, highly non-planar and w i t h nodes having a r b i t r a r i l y high degree. Since in many p r a c t i c a l problems node degree may be bounded (e.g., fan-in, fan-out restrictions on circuit elements), or graphs may be planar, it is w o r t h w h i l e to determine w h e t h e r the complexity of the graphs involved in these reductions was necessary. contradicts either the definition of W* or the choice of g. Thus, L(v ) < R(v ~ Let t = max[g(v):veN',g(v) < g~v )~ :d L(v) > R(v)]. The value of t is~we~! defined since there exists a ueU w i t h g(u) < g(vo) and L(u) : R(u) = O. Thus, if g(v]) = t and g(v2) = t + i, we must have L~v2) < R(v2). The function ~eF, w h i c h is identical to g except that > completes II, Restricted 5] > since k is an integer, l[[u,v]eA:UeSl,VeS2] {u, hA l~(u)-~(v)I + (nh+n)l[ [u, v]eA :UeSl, and g(u)>g(v)]l . ~ote that veU implies L(v) = R(v) = O. Suppose L(v ) > R(Vo). Let UoeU be such that g(u ) J g~u) for all ueU. Then by definition ~f v , g(v ) < g(v) < g(u ) implies that veU. CoNsider the--function gcF which is identical to g except that g(Vo) = g(u ) and g(u ) : g(Vo). It is not difficult to see Zhat Ig(u)-g(v)l + \3/ Ig(u)-g(v) I [u,vlzA u,veS 1 On the other hand, one of the authors has shown [St73] that the question of w h e t h e r a graph is 3-colorable (GRAPH 3-COLORABILITY, itself a restriction of CHROMATIC NUMBER) is NP-complete, even when the domain is restricted to include only planar graphs. In this section, we shall present further completeness results, Ig(u)-g(v)l [u,v]cA U, V6 S 2 52 c o n c e r n i n g GRAPH 3-COLORABILITY, NODE COVER, and H A M I L T O N I A N CIRCUIT. The formal d e f i n i t i o n s of these problems appear in the appendix. know w h e t h e r PLANAR D I R E C T E D I ~ M I L T O N I A N CIRCUIT, PLANAR U N D I R E C T E D H A M I L T O N I A N CIRCUIT, or PLANAR U N D I R E C T E D ~ M I L T O N I A N PATH are NP-complete, and these remain s i g n i f i c a n t open problems. The f o l l o w i n g table gives the p r i n c i p a l r e s t r i c t e d versions of these problems w h i c h we prove to be p o l y n o m i a l complete: The proofs of the results given in the table follow. For each problem, we show that there is a known N P - c o m p l e t e p r o b l e m w h i c h reduces to it. PROBLEM i. PLANAR GRAPH 2. U N D I R E C T E D 3. PLANAR 4. NODE 3-COLORABILITY HAMILTONIAN DIRECTED T h e o r e m 2.1. PLANAR GRAPH 3 - C O L O R A B I L I T Y PLANAR GRAPH 3 - C O L O R A B I L I T Y W I T H NODE DEGREE AT MOST ~. CIRCUIT HAMILTONIAN PATH COVER 5. PLANAR NODE NODE Proof: The key to our c o n s t r u c t i o n will ~ e use of "node substitutes." Figure I(A) shows the 3-outlet node substitute H3, w i t h its first, second, and third output nodes labelled. For k > 4, the koutlet node substitute H k is formed by a d j o i n i n g to Hk_ I a copy of H~ having its first outlet c o i n c i d i n g w i t h 5utlet k-i of H~ 7. The outlet nodes of H k are the n o d e ~ - ~ a v i n g degree 2. The outlets w h i c h o r i g i n a l l y b e l o n g e d to H k I retain the same labels, w i t h the second outlet of th~ a d j o i n e d HR b e c o m i n g outlet k-i and its third outl~t b e c o m i n g outlet k. Figure I(B) shows H 5. COVER DEGREE AT M O S T i. 4 2. 3 3. }~-OUT, 4. 5. 3 6 3-1N For results 3 and 5, it was not p r e v i o u s l y known if the p l a n a r problems were complete, even if no r e s t r i c t i o n s were p l a c e d on node d-~grees. The degree constraints in 1,2, and ;~ are all best possible, in that each of the problems becomes easy if the r e s t r i c t i o n on node degree is reduced by I. NODE COVER and U N D I R E C T E D } ~ M I L T O N I A N CIRCUIT are clearly trivial for graphs w i t h m a x i m u m degree 2, and a w e l l - k n o w n result of Brooks [B!$1] implies that a c o n n e c t e d graph w i t h m a x i m u m degree 3 is 3-colorable if and only if it differs from K~4, the complete graph on four nodes, w h i c h is easy to determine. It is easy to prove by i n d u c t i o n that, for all k > 3, the f o l l o w i n g facts hold: (2.1A) H~ has 7(k-2) + i nodes, i ~ c l u d i n g k outlets. (2.1B) No node of H k has degree e x c e e d i n g ~. (2.1C) H k is planar. (2.1D) Hb is 3-colorable, but not 2Ucolorable, and every valid 3 - c o l o r i n g of H k assigns the same color to every outlet node. Given any p l a n a r graph G, we show how to c o n s t r u c t a p l a n a r graph G', using node substitutes, w h i c h has m a x i m u m degree I~ and w h i c h is 3-colorable if and only if G is 3-colorable. In a d d i t i o n to the above results, there are a n u m b e r of more or less immediate corollaries. Result 2 implies that D I R E C T E D ! ~ H I L T O N I A N CIRCUIT w i t h node degree b o u n d e d by 3-OUT, 3-1N is NPcomplete; however, the largest degree bounds for w h i c h we know this p r o b l e m to be easy are 2-OUT, I-IN or 2-1N, 1-OUT. Also, we may substitute PATH for CIRCUIT in result 2. However, we do not 2 Fix a p l a n a r e m b e d d i n g of G and a r b i t r a r i ly index the nodes of G w h i c h have degree e x c e e d i n g 4 as V l , V o , . . . , v r. We construct a sequence of graph~ G = G~,G~, ,G = G' i "'" r as follows: G i is c o n s t r u c t e d from Gi_ I. 2 (A) 3 (B) Figure I. Hode substitutes 53 H 3 and H 5 4 It is easy to prove by induction that the f o l l o w i n g facts hold for all k > i: Let d be the degree of v~ in Gi_ I and let {u_,v.],[u2,v.], % ... ,~Ud,Vi] be the edges ineldent w i t h vi, taken in clockwise order. To form Gi, delete node v i from Gi_l, replacing it w i t h a copy of H~, and replace each edge [ui,vi] by an ecge joining ui to outlet j ~f the node substitute. (2.2A) F k contains k 2 + k - i nodes, none w i t h degree e x c e e d i n g 3. (2.2B) Fb has one inlet node of degree 1-and k outlet nodes, none w i t h degree e x c e e d i n g 2. (2.2C) For any outlet node of Fw, there exists a path from the inlet to that outlet w h i c h includes each node of F k exactly once. It follows from the c o n s t r u c t i o n and p r e v i o u s l y stated facts that, for 0 < k < r, G k is planar, G k has r-k no~es ~ i t h degree e x c e e d i n g )~, and G k is 3-colorable if and only if G is 3colorable. Thus, G' : G r satisfies all the required properties, c o m p l e t i n g the proof. One more p r o p e r t y of F~ will be required and, since its p r o o f iZ not quite as straightforward, we present it as a lemma. Lemma 2.2.1. Suppose a graph G contains a s u b g r a p h H isomorphic to Fk• k ~ i, in such a way that (i) no two nodes of H are adjacent in G unless the c o r r e s p o n d i n g nodes of F~ are adjacent• and (ii) any ~ode of H w h i c h is adjacent to a node of G not b e l o n g i n g to H c o r r e s p o n d s to either an inlet or outlet node of F k. T h e o r e m 2.2. UNDIRECTED HAMILTONIAN CIRCUIT ~ U N D I R E C T E D HAMILTONIAN CIRCUIT W I T H VERTEX DEGREE AT M O S T 3 Proof. This c o n s t r u c t i o n will also use a "node substitute," w h i c h is formed from a special graph, called a fan. The oneoutlet fan F I consists simply of a sin-gle node. The single node, labelled Uq I, is both the inlet and the outlet T . . . or • PI. _nductively, assume we. have defiffed the k - o u t l e t fan Fk, k > i, w i t h inlet U I i and outlets U~ I through U~ ~. T~e (k+l)-outlet ~&n Fk+ I is fb£Red from F k by adding the f o l l o w i n g nodes and edges: Nodes: Uk+l,i, Proof of Lemma. The Lemma holds t r i v i a l l y for k = i. Suppose it holds for F k i, k > i, and c o n s i d e r a graph G w h i c h ~ontains a s u b g r a p h H isomorphic to Fk in the s p e c i f i e d manner, and w h i c h contains a H a m i l t o n i a n circuit C. We consider the nodes of H as b e i n g l a b e l l e d i d e n t i c a l l y w i t h the c o r r e s p o n d i n g nodes of F~. Observe that H, and hence G, contain~ a s u b g r a p h H' isomorphic to Fk_ I w h i c h has inlet node U I i and w h i c h satisfies the two conditions of the Lemma. By the i n d u c t i o n hypothesis, C contains a path from U1 1 to some U k i " w h i c h includes p r e c i s e i # the nodes - 'J b e l o n g i n g to H'. The node Uk_ I j and the remaining nodes of H are shown ~n Fig. 3. i <_ i <_ k + i; Sk+l,i, i< Edges: Then, any H a m i l t o n i a n circuit of G contains a p a t h from the "inlet" of H to some "outlet" of H, c o n s i s t i n g p r e c i s e l y of all the nodes of H. i<k+l. [Uk, i,Sk+l,i] , [Uk+l,i,Sk+l,i], i <_ i < k; 1 <_ i <_ k [Uk+l,i+l,Sk+l,i], i + i; <_ i <__ k; [Sk+l,k+l'Uk+l, i ] " The inlet of Fk+ I is UI, I and its o u t l e ~ are Uw~ l Figure 2 _, I through U k + l , k + l " shows Pi,92, and F 3. ~C]iS3, 3 {'ho~$2,2 U1,1 tl U1,1 • ~oS2, 2 I ~ U2, 2 U2,2 U1,1 U 3, 3 - S3, 2 I ~ $2' t U2, 1 e I ] S3' 1 U3, 1 F~ F3 F2 Figure 2. Fans FI, F2, 54 and F 3 Uk-1, j --0-- Uk,1 Uk, j Sk, 1 Figure Consider Uv i and s~guction there are n o d e s of • ' . . . --0 . Sk, j Uk, j+l 3. R e m a i n i n g the set T of n o d e s of the f o r m S~ ~, i < i < k. By the con~ f ~ F k aid t~e a s s u m p t i o n s on H, o n l y two w a y s by w h i c h the T can be a c c e s s e d by c i r c u i t C: •D Sk,k of H v l ( i ) , v 2 ( i ) ..... Vn(i ) and its o u t l e t s by ul(i),u2(i), ,un(i ). The s p e c i f i c a t i o n of G' is c o m p l e t e d by i n c l u d i n g in G', for e a c h edge [vl,vi]eA the two edges [ u j ( i ) , v i ( J ) ] an~ [ ~ i ( J i , v j ( i ) ] . (a) F r o m n o d e s of G n o t in H via an outlet U- • (b) F r o m an Ko d ~ l e t U -~ - ~i . , l• of H' • via the c o r r e s p o n d i n g ~k,i" to Since C c o n t a i n s a p a t h f r o m U I U ~ i . w h i c h u s e s all the n o d e ~ ' ~ f H', t~e 6 ~ l y w a y that (b) can o c c u r is via the edge [Uk_ 1 4,S k ~]. U s i n g this edge, the p a t h from ~ ~ £~ U, ~ . can be i ~-i,J . e x t e n d e d to a p a t ~ f r o m U~ ~ to e i t h e r I% • . . I ~ ~,j U k ~+i c o n s i s t i n g p r e c l s e ~ of th_ n o d e s b e i 6 n g i n g to H. If this is not w h a t occurs in C, t h e n e i t h e r that edge is not used, or it is u s e d and C exits f r o m the set of n o d e s T b e f o r e all n o d e s of T have b e e n covered. In e i t h e r case, a n o n - z e r o and e q u a l n u m b e r of U - t y p e and S - t y p e n o d e s f r o m T w i l l r e m a i n to be c o v e r e d by s u b s e q u e n t v i s i t s of the H a m i l t o n i a n circuit to the set T. H o w e v e r e a c h such visit of T b y C m u s t b o t h e n t e r a n d leave via U - t y p e node, and hence m u s t use one m o r e U - t y p e n o d e t h a n S - t y p e node. Thus, not all the S - t y p e n o d e s c o u l d be c o v e r e d b y C, c o n t r a d i c t i n g the fact that C is a H a m i l t o n i a n circuit. Therefore, C must c o n t a i n a p a t h f r o m U 1 I to some o u t l e t Uk i c o n s i s t i n g p r e c i ~ @ l y of all the n o ~ e s of H, as claimed. The L e m m a follows by i n d u c t i o n . ~ nodes Uk,k The f o l l o w i n g u s e f u l p r o p e r t i e s of d o u b l e - f a n s D n are i m m e d i a t e c o n s e q u e n c e s of the c o r r e s p o n d i n g p r o p e r t i e s for Fn: (2.2a) (2.2b) or 2.2c) 2.2d) D n c o n t a i n s 2 ( n 2 + n - l ) nodes, n o n e w i t h d e g r e e e x c e e d i n g 3. The n inlet n o d e s and n o u t l e t n o d e s of D e a c h have d e g r e e not e x c e e d i n g ~. For e a c h o u t l e t and e a c h inlet of D_, there is a p a t h b e t w e e n them w h i c h i n c l u d e s e v e r y node of D n e x a c t l y once. S u p p o s e an u n d i r e c t e d g r a p h G contains a subgraph H isomorphic to D n in the m a n n e r s p e c i f i e d in L e m m a 2.2.1. Then every H a m i l t o n i a n c i r c u i t of G contains a p a t h f r o m an "inlet" of H to an " o u t l e t " of H, c o n t a i n ing p r e c i s e l y all the n o d e s of H. O b s e r v e that G' has m a x i m u m d e g r e e 3, since e a c h inlet or o u t l e t of a Dn(i ) has at m o s t one edge j o i n i n g it to a node not b e l o n g i n g to Dn(i), u s i n g p r o p e r t i e s (2.2a) and ( 2 . 2 b ) . S u p p o s e G' has a H a m i l t o n i a n c i r c u i t C, i.e., an o r d e r i n g of the n o d e s as YT,Y2, .... Ym, w h e r e m = INrl, such that f6r all j, i < j < m, [y~,y._~]~A' and s u c h that [y_~y~]c--A'. W$ m ~ m a s s u m e withm ± . out loss of g e n e r a l i t y that Y7 and Ym do not b e l o n g to the same d o u b l e ' f a n Dn~i ). Thus, by c o n s t r u c t i o n of G', one of Y l , Y m must be an inlet of some fan Dn(i ) an~ t~e o t h e r m u s t be an o u t l e t of a n o Z h e r fan Dn(j). Since G' is an u n d i r e c t e d graph, we m a y a s s u m e that Yl is an inlet of some fan D_(i). Then, b y - ( 2 . 2 d ) , C d e t e r m i n e s an o r d e r i n g D n ( i l ) , D n l i 2 ) ..... Dn(in) of the d o u b l e - f a n s s u c h that all the n o d e s of Dn(ik) p r e c e d e all the n o d e s of Dn(i. ) in C w h e n e v e r i < k < j < n. But the J c o n s t r u c t i o n of G' i m p l i [ s that v i l , v i o , . . . , V i n m u s t then be a H a m i l t o n i a n c i r c u i t of G. (Notice that this a r g u m e n t G i v e n a g r a p h G = (N,A), we n o w show how to c o n s t r u c t a g r a p h G' = (N',A~), h a v i n g m a x i m u m node d e g r e e 3, such that G' contains a H a m i l t o n i a n c i r c u i t if and o n l y if G does. Let N = [Vl,V 2 ..... Vn] w h e r e n = INf. Let D n d e n o t e the d o u b l e - f a n f o r m e d b y j o i n i n g two c o p i e s of F n w i t h an edge c o n n e c t i n g t h e i r inlet nodes. The outlet n o d e s of one of the copies of F n are the inlet nodes for Dn, and the o u t l e t n o d e s of the o t h e r are the o u t l e t n o d e s of D_ For e a c h node v. in N, the g r a p h Sr c ~o°n t a i n s a c o p y D n ( i ~ of D n. The i n l e t s of Dn(i ) w i l l be d e n o t e d b y 55 fails when n = 2, however, we may let G' = G.) The set of edges is made up of two parts, A : A] L_)Ao, the first of w h i c h depends only Dn n Znd t and forms a skeleton for G (see Figure 4): in this case Conversely, suppose vi~,vio,._.,Vin is a H a m i l t o n i a n circuit C 6f G? By construction of G some outlet of Dn(i~ ) must be connected to some inlet of Dn@i~+~,, in G', for i < j < n, and similarl9 ~or Dn(in) and--Dn(il). It is then a simple matter to construct a H a m i l t o n i a n circuit in G' using (2.2c). A I = <ao,j,Y0,j>, <Yn, j,an+l,j>: l<j<t] L3 [<Y0,j~a0, j+l> ' < a n + l , j , Y n + l , j + l > : l<j<t-l] Therefore, we have shown that G' contains a H a m i l t o n i a n circuit if and only if G does, completing the proof of Theorem 2.2.I U < Y o , t , f l ~' < f n + l ' y n , l ~] < fi' di>' < fi' el>' < di' fi+l>" <ei,fi+l>, <di,ai,l>, <ei,ci,t) , <ci,t,ei>: Theorem 2.3: EXACT COVER ~ PLANAR D-J~MILTONIAN PATH. Proof: Given any collection S of sets, we must construct a planar directed graph G w h i c h has a H a m i l t o n i a n path if and only if S contains an exact cover. We first introduce some terminology. <ai,l,di>, l<i<n] < ci, j,ai,j+l>, <ai,j+l,Ci,j> : l<i<n,l<j<t-l}. Let G = (N,A) be a directed graph with nodes Pl,Po,-..Pm. The edges in A are ordered pa~rs < P i , P j > " We will call Pi and p j a d j a c e n t w h e n e v e r either <Pi,p~eA or <,pi,Pi>eA. Any H a m i l t o n i a n path ~H-path) of G can be identified with a s - - ~ g pj (l~Pi(2],. ~..pi(-) ~ _°f nodes such that n = m~<' tP4filJ and \PI(ii, Pi(j+l)>CA forJ~l i ! ~ < m. The remaining edges in A = A ~ A connect, for each i and j, ±i\ ~ ~ n, I < j < t, certain nodes from [a~ ",~i -,c- .y- - .,y- .], depending on whe~er 6~ n ~ t 0 u ~ - @ $ 1 o n ~ J t o S i. If u. ~ S~, then A~Ucontains the eight edges s~own in Fig. 5~. If u~ e S~, then Ao contains the seven edge~ sho~n in Fig. 5B. Let N* denote the set of all finite strings of elements from N. A partial H-path oJ for G is an element of N* w h i c h is a ~refix of some H-path for G. For any partial H-path ~ for G, ~eN* is a k - e x t e n s i o n of ~ if the length of • is k and m~ is a partial H-path for G. This completes the d e s c r i p t i o n of G. The reader should observe from Figs. 4 and 5 that G is planar. Informally, the relationship b e t w e e n G and the covering p r o b l e m is as follows. Suppose that we are b u i l d i n g an H-path for G, in step-by-step fashion, and, at the same time, generating an exact cover for U. Clearly, the H-path must begin w i t h a n I,Yo 1,an o,Yn o,...,ao t,Yn ,, f]. F~eac~k,~l~< ~'< n, at the ~ @ p t~e H-path reaches Z~, We choose edge <f,.,ek> if S,. is to ~e included in the coger, and e~ge < f ~ , d k > if it is not to be included. We t~en proceed left (right) along the a k ,J~,b-K .,c.K " line of the graph, exiting fr$~ dk($k) , and finally a r r i v i n g at fk+1" Helping us in the --- direction to travel tha t choice of which line is the fact that the nodes Y~_] i < j < t, "remember" which e l e m e ~ t ~ ' ~ f U ha~e b~en covered by p r e v i o u s l y selected sets. Specifically, Yk-i ~ has already been visited by the parti$~ H-path if and only if element u. has not been covered yet. Note that, ~hen w~ ~re about to make our first choice, at fl, all nodes YO . are already in the path and no elemefl~ from U has been covered. When we reach fn+l, after having made a decision for each set Sk, none of the y . can have been visited by the partial H-~&@h (or it could not be extended to an H-path), so all elements of U have been covered by the For any string ~ = b l b p . . . b k e N * , we say that yeN belongs to ~ if and only if v = b i for some i,i---< i < k, and < u , v > e A belongs to ~ if and ~nly--if u = b i and v = bi+ I for some i, I <_ i < k. Now suppose we are given a collection S = [SI,S 2 ..... Sn] of sets w i t h ~ Si 5=1 = '1 = ( U l , U 2 , .... u~:. ,The p l a n a r directed graph G ~,~,A) is specified as follows: The set N of nodes, on n and t, is which depends on'ly N = [bi,j,ci, j: i < i i n, i <__ j < t] ~ [a. .: l,O LO [Yi,j: 0 < i < n + I, i < j < t] . . . . 0 <__ i <_ n, i <_ j <_ t] k9 [di,ei,fi: i < i <_ n] t_) [fn+l]. 56 C C • . / \./\./ - t ~f ' ' u . . i • ~'~. .~--~.- • .... .,#r-'--" • J ,, " ~ . ~ . • &z &~ • ~.o, . ~. • ~ 4b~ - - 0 C~.~ I~%~ c~o .~%~ ~ • • q~ ~ Q (~--- • . . . . • ~ a~|a,~,l %,i c,,,i a~,~. b',,,., c.,,.+. L • • ~.v" 8~.~ ~z,+. c ~ • -. • • O( ez • •q~ b~ c~,~ ~ j / ~1~,1 ~"t.-I J en "",jl,o a..,~h,,t ~÷1 Figure 4. The Skeleton of G. ci.,3 CA) ai,~ • \ ,,'~ . ci,~ " Jt~3 Figure 5. Edges 57 in A 2 B selected sets. The edges of Ap force the t r a n s m i s s i o n of i n f o r m a t i o n from one row of Yk ~ nodes to the next, and also prevent £~t S~ from b e i n g chosen w h e n e v e r any of its-members has already been covered. This latter p r o p e r t y insures that the sets in the cover are disjoint, as required by E X A C T COVER. insure that < x , , c i .> belongs to 7; that is, c. • does not ~$t b e l o n g to the H-path and t~@Jonly way that path can reach c. . is through x'. This c o n t r a d i c t i o n pro~@~ (iS). The other eases follow similarly.| U s i n g Lemma 2.3.1 and our informal d e s c r i p t i o n of the c o r r e s p o n d e n c e b e t w e e n H-paths and exact covers, the reader should have no d i f f i c u l t y in v e r i f y i n g that G has an H - p a t h w h e n e v e r S contains an exact cover. To complete the p r o o f of T h e o r e m 2.3, we must show the converse. The f o l l o w i n g Lemma-shows how the edges in A 2 force the desired paths, by giving the relevant o r o p e r t i e s of Figs. 5A and 5B. Figures 6A and 6 B show all edges of G w h i c h are incident w i t h nodes of interest. Lemma 2.3.1: Fix i and j, i < i < n, 1 < j <_ t. Let x = d i if j =--i a~d x = c i . i otherwise; x I = e i if J n and x I = a ~ - + l otherwise. Let co be partiam J-path of G satisfying: any Suppose that G has an H-path 7. Let T = [kl < f k , e k > belongs to Z]. We shall show that S' = [Skl keT] forms an exact cover for U. Define the partial unions U o : ~ and U k : l ~ < k Si• 1 ! k ! n. leT (i) every yeN - [a. .,b~ ..,c. .] l,J , 1 J adjacent to Yi-l,j ~e~ong~ to co, and (ii) None of ai•j,bi,j,ci, j belongs to co. Then we have the following: Lemma 2.3.2: For each k, 1 < k < n + i, if co(N* and cofk is a partial--H-p~th of G, then Then the f o l l o w i n g hold: Case i. uj~S i (Figure 6A) (IL) if • = coxai ~ is a partial H - p a t h of G, the o~Yy p o s s i b l e 4-extensions of T are bi,jYi_l, jCi, j.x t and b. "Yi .c. .x' . (IR) I~'@ = ' ~ x ~ ' ~ ~ is a partial H - p a t h of G,-tNe only p o s s i b l e %-extensions of • are bi,jYi_l, jai,jx and bi,jYi,jai,jx. Case 2. 2R (i) None of {ai,~,b- .,c~ ~,d~,eJ : k<i<n, ~<j<t~ bel~ng t~ co, (ii) ATl-of 1[~--~,b~ ~,c. .,d.,e. • . ~ • i i i" l<l<k-l, i<J<t} 6eloh~ to co, (iii) For each j, 1 < j < t• Y~Yi{]'J belongs to co i~ a n ~ on uj~Uk_ ~ (iv) If there exists j such that u l c U w _ l f h Sk, then dv is the only i Z e x Z e n s i ° n - ° f cofk" uieS i (Figure 6B) Proof of Lemma. The proof is by induction. The basis k=l is immediate since any H-path must b e g i n w i t h a 0 ~ Y O ~ l a O , 2 ~ . . a o ~ y n ~ i ~ ef~ y. The induction step'zoilows almost' by Lemma 2.3.1. The only other p o s s i b i l i t y is that cofv might be e x t e n d e d by d k f~+l (or by ek ~k.~). But then an a r g u m e n ~ similar ~o Z~$ proof of Lemma 2.3.1 shows that e k ( r e s p e c t i v e l y dk) must be the last node oT the H-path• w h i c h is i m p o s s i b l e . ~ If • = o~x'c, i is a partial H-path of G,~'the only possible 3 - e x t e n s i o n of • is bi,jai,jx. Proof of Lemma: (Case IL) Let 7 be an H - p a t h w i t h p r e f i x T. The last node of 7 must be a . . . . . The only possible iI~" • O 4 - e x t e n s i o n o~ • which has been excluded is b i ~y. .vv, w h e r e v ~ c- .. But then c. node of 7, i . @gula0have to be the ~ t smf~@e p r o p e r t i e s (i) and (ii) of co ai,]<!/bi'j ci,j x,<-'Y" . It is now clear that x' Figure 6. Cases for Lemma 2.3.1 58 [SwIkeT ] is an exact c o v e r for U! Since a n y H - p a t h m u s t have the form ~ f n ly n i a +- -Yn -a +I .... Yn tan+l t' ~ e m m d 2 . ~ . ~ ' ~ i m i ~ ~ o r ' { = n + l i n { u r e s t~at <9~ S~ = U = U, and (iv) % n s u r e s the d m s j o l n t n e s s of the sets in ~ne cover. This c o m p l e t e s the p r o o f of T h e o r e m 2.3.2. I BI : and B2 = Ti, 1 Fi, 1 Ti, 2 Figure as,t = xi is the variable jth of x i in C]. The graph N : A= G = (N,A i is d e f i n e d ~ NiQJ i=l i=l AiU P h<9=l N h by: , C BIUB 2. h=l O b s e r v e that e v e r y n o d e of G has d e g r e e at m o s t 3. W e s h o w that the set C of c l a u s e s is s a t i s f i a b l e if and only if G has a n o d e c o v e r of size 5P. The f o l l o w i n g p r o p e r t i e s H i are e a s y to verify: W e d e s c r i b e the g r a p h G : (N,A) in s e v e r a l steps. First, for e a c h v a r i a b l e x., a' s u b g r a p h H.i = (N.,A.), a 1 we have ' i i s i m p l e c i r c u i t w i t h l N.I = IAil = 2m(i), as s h o w n in Fig. 7. O ~ s e r v e the a l t e r n a t e l a b e l l i n g of the nodes. For e a c h c l a u s e Ch, we have a s u b g r a p h H~ = (Nh,Ah) w h e r e Nh = [Vh, l , V h , 2 , V h , 3 ] a n d A ~ c o n s i s t s of an edge j o i n i n g e a c h p a i r of n o d e s b e l o n g i n g to N h. The r e m a i n i n g edges, w h i c h e a c h j o i n a node f r o m some set N. to a node f r o m some set Nh, are as foll~ws: • [[Fi,j'Vs,t]: occurrence COVER WITH • jth of v a r i a b l e x i in C] Proof. S u p p o s e we are g i v e n a set U--/-TC],C O ..... Cn] of d i s j u n c t i v e clauseZ, ~ a c h c o n t a i n i n g no m o r e than 3 literals. As in the p r o o f of T h e o r e m i.i, we m a y a s s u m e that e a c h c l a u s e contains exactly 3 literals, possibly with duplication. Index the l i t e r a l s o c c u r r i n g in c l a u s e C h as ah,l,a h 2' a n d a h ~, i < h < p. Let x l , x o , . ~ . , x ~ d e n o t e ' ~ h e va--ria[les o c c u r r l n g ~ i n the~p clauses, and for e a c h i, 1 < i < n, let m(i) d e n o t e the n u m b e r of o ~ c u r T e n c e s of v a r i a b l e x i (as l i t e r a l x~ or l i t e r a l xi) in the clauses. Arbitrarily index t~e m(i) o c c u r r e n c e s of v a r i a b l e x i as o c c u r r e n c e i, o c c u r r e n c e 2,..., o c c u r r ence m(i). W e shall c o n s t r u c t a g r a p h G, h a v i n g node d e g r e e at m o s t 3, and give an i n t e g e r k > O, s u c h that C is s a t i s f i a b l e if and o n l y if G has a n o d e c o v e r of size k. C as, t = x i is the occurrence O b s e r v e that the d i r e c t e d g r a p h G cons t r u c t e d in the p r o o f n e e d not have a r b i t r a r i l y large degree, in fact, no node has i n - d e g r e e e x c e e d i n g 3 or outd e g r e e e x c e e d i n g 4. It is not known, however, w h e t h e r these are the s t r o n g e s t p o s s i b l e d e g r e e c o n s t r a i n t s for w h i c h PLANAR DIRECTED HAMILTONIAN PATH remains NP-complete. T h e o r e m 2.4: SAT3 ~ N O D E ~ Y O ~ ~ AT M O S T 3. [[Ti,j,Vs,t]: of the subgraphs (2.4A) T h e r e e x i s t s a n o d e c o v e r for ~i c o n t a i n i n g m(i) nodes, i n c l u d i n g all n o d e s T. • and no n o d e s F. . There al~6Jexists i " such a n 6 ~ e c o v e r w h i c h i n c l u d e s all n o d e s F. . and no n o d e s T.i,j" i,j (2.~B) No n o d e c o v e r for H i c o n t a i n s f e w e r than m(i) nodes, a n d e v e r y node c o v e r for H i w h i c h i n c l u d e s b o t h a node F i . and a n o d e T. _ m u s t c o n t a i n ~ @ r e than m(i) n~d~s. Now, s u p p o s e we are g i v e n a t r u t h a s s i g n m e n t to the n v a r i a b l e s w h i c h s a t i s fies the set C of clauses. The c o r r e s p o n d i n g node c o v e r S c o n t a i n s the f o l l o w ing nodes: (i] for e a c h v a r i a b l e x~ w h i c h is set T, the c o v e r of m(1) . n± o d e s for H i "true w h i c h i n c l u d e s all T i ~. (ii) For e a c h v a r i a 6 ~ e x i w h i c h is set "false," the c o v e r of m(i) n o d e s for H i w h i c h i n c l u d e s all F.l,j" Ti,m(i) Fi,2 7. A S u b g r a p h 59 Hi Fi, re(i) Now for each i,j, 0 < i,j < 2, let c[i,j] be the m i n i m u m cardi~ality--for all node covers C of H obeying (iii) For each clause C h, all the nodes of Nh except some one of-them V- • such that literal a h . is true for t~i{ truth a s s i g n m e n t (at lSast one such literal exists since the clause is satisfied). Clearly, these nodes cover all of the edges b e l o n g i n g to the sets A~, i < i < n, and AI~, i < h < p. E a c h edge~[Ti 7, VsTt ] in B~ is a~so ~ o v e r e d since eitheg~V~ t belongs to S or a = x. is true an T. . belongs to S~'tSimi~arly, each edge i~'~ o is covered by S. Thus, S is a node coveg. Furthermore, the number of nodes in S is I [V1,V{] >. j (m(i)) = 2p + 3P = 5P, i=l a.s required. Conversely, suppose we have a node cover S for G such that ISt = 5P. S must contain at least two nodes from each N h in order to cover the edges in Ah, for a total of at least 2p such nodes. Similarly, by (2.4B) S must contain at least ~ (m(i)) = 3P nodes from the N i. i=l •0 i 2 0 13 14 15 1 13 13 14 2 14 14 15 From the table, we observe f o l l o w i n g p r o p e r t i e s hold: that the (2.5A) For 0 ~ j S 2, c[l,j] < i and c[j~l] (2.5B) - c[j,1] = (i) Draw G in the plane, a l l o w i n g edges to cross each other. (ii) Replace each c r o s s i n g by a copy of H, a s - s h o w n in Fig. 9. Proof. The key structure used in this p ~ is the graph H p i c t u r e d in Fig. 8, w h i c h w i l l b e called a crossover, w i t h outlets Vl,Vl, V2, and v2, as labelled. ~ The crossovers w h i c h replace crossings on the edge [x,y] will be called crossovers on the x-y line. The edges c o n n e c t i n g ~Tf~ese crossovers to each other and to x and y will be called edges on the x-y line. The endpoints of these edges will be called the nodes on the x-y line. Such nodes w h i c h are a T ~ o c r o s s o v e r outlets w i l l be called the x-y outlets of their crossover. The one w h i c h is nearest x w i l l be the crossover's y outlet, the one nearest y its x outlet, f o ~ crosso v e r on the x-~ T T ~ . ~i Va" v; 8. - c[l,j] = 1 Given a graph G = (N,A) we construct a p l a n a r graph G' (NJ,A ') u s i n g these crossovers as follows: NODE COVER ~ PLANAR NODE Figure - c[0,j] - e[jfO] < O. For 0 ! J ! 2, c[2,j] c[j,2] Remark. T h e o r e m 2.4 was o b t a i n e d ~ndently by Peter H e r r m a n n [H73]. T h e o r e m 2.5: (-'/ C I = j. TABLE II. Values of c[i,j]. Hence S must contain e x a c t l y 2 nodes from each N', and e x a c t l y ~ d e s from each N i. T~us by ~ - A ~ - a n d (2.4B), S must contain, from each N_., either all the T. • nodes and none Sf the F~ ~. nodes, i, ±,d or ~ii the F. . nodes and none of the T i ~ nodes, i A 3 c o n s i s t e n t truth assignme~ can be o b t a i n e d by setting xl "true" if S contains all the T.. ,.-nodes, and setting x_. "false" otherwi~& d. The reader may verify that, because of the edges in B I and B2, this truth setting satisfies %he set C of c l a u s e s . ~ UDVE~ and I[V2,V2] Observe that, by symmetry, w h e n i or j equals i, the value of c[i,j] is independent of w h i c h element of the c o r r e s p o n d i n g pair is i ~ . Table II gives the values of c[i,j]. We leave to the reader the s t r a i g h t f o r w a r d but tedious v e r i f i c a t i o n of the entries. n 2p + ~h C I = i Crossover 60 H. Jy /i \ BEFORE Figure 9. (G) Construction AFTER of G" (only o u t l e t s of c r o s s o v e r s shown). crossover. T h u s S < 9 S' <9 S,, is a n o d e c o v e r of G' h a v i n g k + 2d + l i d : k + 13d nodes. Let d be the n u m b e r o f c o p i e s of H u s e d in c o n s t r u c t i n g G'. O b s e r v e that the e d g e s of G" c a n be p a r t i t i o n e d into two sets: line edges, t h o s e w h i c h a r e on the x - y line for some [x,y]¢A, a n d c r o s s o v e r edges, t h o s e w h i c h are p a r t o f one o~' the d c r o s s o v e r s . A l l the e d g e s o n the x - y l i n e c a n be c o v e r e d b y t a k i n g e i t h e r x a n d a l l the x - o u t l e t s o f c r o s s o v e r s o n the line, or y a n d a l l the y outlets. The e d g e s in the c r o s s o v e r s c a n o n l y be c o v e r e d b y c r o s s o v e r n o d e s . C o n v e r s e l y , s u p p o s e t h e r e is a n o d e of G having k + 13d nodes. Let K * = min[[ S I : S is a n o d e cover M of G" a n d cover of G'], and Now, s i n c e in G ~ e a c h e d g e - c r o s s i n g o f the p l a n a r r e p r e s e n t a t i o n of G has b e e n replaced by a planar graph which itself c o n t a i n s n o c r o s s i n g s , G t is p l a n a r . Moreover, the s i z e of G t is c l e a r l y at m o s t a p o l y n o m i a l in the size o f G. The p r o o f of the T h e o r e m w i l l thus be c o n c l u d e d b y s h o w i n g that, for a n y k, G has a n o d e c o v e r of size k if a n d o n l y if G" has a n o d e c o v e r of size k + 13d. S u p p o s e t h e r e is a n o d e c o v e r S of G = (N,A) w i t h lSl = k. We construct a node c o v e r of G" f r o m S as f o l l o w s . For each e d g e [x,y]eA, let f ( x , y ) be a n e n d p o i n t of that e d g e w h i c h is in S. Then define S" = (G') [v:v is the f(x,y) o u t l e t for a c r o s s o v e r on the x - y line for s o m e [x,y]eA]. = IS: S is a n o d e cover ISI = k*] For each ~(S) m* S~M, define = I [xeS: x is a n o u t l e t c r o s s o v e r in G']I , : min[m(S): node for some SEMI, a n d let S * e M b e some n o d e c o v e r w i t h m ( S * ) = m *. S i n c e S* m u s t c o n t a i n 13 n o d e s f r o m e a c h o f the c r o s s o v e r s in o r d e r for it to c o v e r a l l the c r o s s o v e r e d g e s (see T a b l e II), w e k n o w that I S * ( ~ N I < k. we conclude our proof by s h o w i n g t~at S = S*(-~ N is a n o d e c o v e r of G. S u p p o s e it is not. Then there exists some [ x , y ] e A s u c h t h a t S(-~[x,y] : ~ a n d hence S*~[x,y] = @. Let the n u m b e r of c r o s s o v e r s on the x - y line be £. Then t h e r e a r e £ + i e d g e s o n the x - y line, a n d h e n c e at l e a s t £ + i o f the n o d e s on the l i n e m u s t be in S*, a n d s i n c e n e i t h e r x or y is, a l l £ + i m u s t be o u t l e t s . If w e let n(i) be the n u m b e r of c r o s s o v e r s o n the x - y l i n e w i t h i of t h e i r x - y o u t lets i n S*, we thus h a v e n ( 2 ) - n ( O ) ~ i. W e s h a l l s h o w that this l e a d s to a c o n t r a diction. S i n c e S is a n o d e c o v e r for G, f is d e f i n e d for a l l e d g e s in A, a n d so S<3S" c o v e r s a l l the line e d g e s o f G". Moreover, s i n c e e a c h c r o s s o v e r is o n two l i n e s in G', S" c o n t a i n s e x a c t l y two o u t l e t s for e a c h c r o s s o v e r , one f r o m e a c h o u t l e t pair, a n d so I S'I = 2d. All that r e m a i n s is to c o v e r the as y e t u n c o v e r e d crossover edges. F o r these, o b s e r v e f r o m T a b l e II that a n y set w h i c h c o n t a i n s two n o d e s f r o m a c r o s s o v e r , one f r o m e a c h o u t l e t pair, c a n b e e x t e n d e d , b y a d d i n g ii of the c r o s s o v e r ' s i n t e r n a l n o d e s , to f o r m a n o d e c o v e r of the c r o s s o v e r m a d e up of c [ l , l ] = 13 n o d e s . Let S" b e the set c o n t a i n i n g , f o r e a c h c r o s s o v e r , a n d 11 a d d i t i o n a l n o d e s n e e d e d to e x t e n d S" to a n o d e c o v e r f o r that L e t X i be the set o f n o d e s in the i th c r o s s o v e r o n the x - y line, 1 < i < £, a n d let S i = X ~ ( ~ S*. Let T i C X ~ be--a n o d e c o v e r of t~e c r o s s o v e r coh-%-~ihing its x o u t l e t (but n o t the y o u t l e t ) a n d the same n o n x - y o u t l e t s as d o e s Si, a n d has m i n i mum cardinality for such node eovers. For e a c h i, let r(i) be the n u m b e r of x - y 61 in polynomial time for "transitively orientable" graphs, "chordal" graphs, "circle" graphs. outlets of the i th crossover w h i c h are in S*. Then we have, by (2.5A) and (2.5B) r(i) = 0 implies Til r(i) Ti I <__I Si I , and = I implies r(i) = 2 implies <_I S i I + i, Both types of results should prove useful to designers of practical combinatorial algorithms. Ti I i l Sil - i. APPENDIX: k9 Ti, S = 6 S i. Since i=l i=l n(2)-n(O) > i we have by the above that Definitions of Polynomial Complete Problems Let T = I TI <I sl S A T I S F I A B I L I T Y W I T H AT MOST 3 LITERALS CLAUSE .(SAT3) [K72] - 1 INPUT: Moreover, T contains at least one fewer x-y outlet than does S, and exactly the same number of non-x-y outlets. Furthermore, T ~9[x] will cover all the line edges that S did, and so T* = (S*-S) ~9 T ~-J[x] is a node cover of G w i t h [ T~I =I S* -I Sl +I T I + 1 < I = m(S* PROPERTY: There is a truth assignment to the variables which simUltaneously satisfies all the clauses in C (a clause is satisfied if any one of its disjuncts is x i for some "true" variable xi, or Z. for some "false" xj). S*I = k*, - 1 = m* - 1, c o n t r a d i c t i n g the definition of m*. S* k_J N is a node cover of G and the theo rem--fs p r o v e d . ~ Thus III. Concluding CLIQUE [K721 INPUT: GRAPH G = (N,A), positive PROPERTY: Notice that, if the graph G given as input for NODE COVER has no node degree exceeding 3, the graph G" constructed in the proof as input for PLANAR NODE COVER will have no node degree exceeding 6. This implies that PLANAR NODE COVER W I T H NODE DEGREE AT MOST 6 is NP-complete. It is not known whether this degree bound is best possible. PER Set of clauses C = fCI, C2, .... C-} ~n variables x~,x-, ,x-, @ach cl[use • l .~ "': n belng the d l s o u n c t l o n of 3 or fewer literals, where a literal is either a variable x i or its negation xi" and m(T*) and integer k G has a clique of size greater than or equal to k, i.e., a set N" C N with I N" J > k and such that for all n l , n ,~_ N" [nl,n2]¢A. EXACT COVER [K72] INPUT: Collection of sets S = [SI,$2,... , Sn ] PROPERTY: S has an exact cover, i.e., a subcollection S" ~ S suc h that U Si : O S~, and for all S]eS" i=l Remarks Si, We have seen that a number of graphtheoretic NP-complete problems remain NP-complete w h e n the structure of the allowed inputs is substantially restricted. Similar questions can be asked for restricted versions of other NP-complete problems. For example, it is not yet known w h e t h e r STEINER TREE [K72] for planar graphs or m u l t i p r o c e s s o r scheduling with 3 processors, unit time tasks, and an arbitrary partial order [U73] are NPcomplete. The open status of U N D I R E C T E D H A M I L T O N I A N CIRCUIT for planar graphs has been m e n t i o n e d previously. SjeS', GRAPH 3 - C O L O R A B I L I T Y INPUT: 9. [St73] G has a legal 3-coloring of its nodes i.e., there is a map f: N ~ [1,2,3] such that [nl,n2]cA implies f(nl) ~ f(n2). U N D I R E C T E D (DIRECTED) (CIRCUIT) [K72 ] HAMILTONIAN Graph G = (N,A). 0 PROPERTY: In examining such problems, it is important to keep in mind that two types of results are possible. Not only is it important to find simple subcases which are still NP-complete, but it is also important to find large subdomains for w h i c h the p r o b l e m can be solved in polynomial time. We have given one example in this latter direction, the case of MAX CUT for planar graphs. Other recent papers [E72,Gav72,Gav73] have shown ~hat CLIQUE and CHROMATIC NUMBER can be solved Sj : Graph G = (N,A) PROPERTY: INPUT: Sifh = PATH (Directed graph (N,A)). G has a H a m i l t o n i a n path (circuit), i.e., an ordering of the nodes = in ,n,, .... n I N I ] such that ~or ~ i~< I NI , [ni,n~±1]eA ~ n ~ n ~ 7 > e A ), and {in th@~circuit-ca~@-only) Ln I N I 'nl]eA ~ n l N I 'nl)eA)" NODE COVER [K72] INPUT: Graph G = PROPERTY: G has a than-or set N ' C 62 (N,A), positive integer k. node cover of size less equal to k, i.e., a subN w i t h IN'I< k and such that for all (x,y]cA, (x,y]gh N" ~ ~. REFERENCES A73. D. Adolphson and T. C. Hu, "Optimal Linear Ordering," SIAM J. Applied Math. 25 (1973), 403-423. B41. R. L. Brooks, "On Coloring the Nodes of a Network," Proc. Cambridge Philos. Soc., 37 (1941), 194-197. C71. E70. E72. Ga72. G&v72. S. A. Cook, "The Complexity of Theorem-Proving Procedures," STOC (1971), 151-158. J. Edmonds and E. L. Johnson, "Matching: A Well-Solved Class of Integer Linear Programs," Combi~&torial Structures and Their Applications, Gordon and Breach (1970), 89-92. S. Even, A. Lempel, and A. Pnueli, "Permutation Graphs and Transitive Graphs," JACM 19 (1972), 400-410. M. R. Garey, R. L. Graham, J. D. Ullman, "Worst-Case Analysis of Memory Allocation Algorithms," STOC (1972), 143-150. F. Gavril, "Algorithms for Minimum Coloring, Maximum Clique, Minimum Covering by Cliques, and Maximum Independent set of a Chordal Graph," SIAM J. Computing i (1972), 180187. Gay73. F. Gavril, "Algorithms for a Maximum Clique and a M~ximum Independent Set of ~Circle Graph," Networks 3 (1973), 261-273. Gr72. R. L. Graham, "Bounds on Multiprocessing Anomalies and Related Packing Algorithms," SJCC (1972), 205-217. H73. P. Herrmann, Reducibility among Combinatorial Problems, Masters Thesis, Massachusetts Institute of Technology (1973). Jo72. D. S. Johnson, 'Fast Allocation Algorithms," SWAT (1972), 144-154. Jo73. D. S. Johnson, "Approximation Algorithms for Combinatorial Problems," STOC (1973), 38-49. K72. R. M. Karp, "Reducibility Among Combinatorial Problems," Complexity of Computer Computations, R. E. Miller and J. W. Thatcher, eds., Plenum Press, New York (1972), 85lO4. 63 KT0. B. W. Kernighan and S. Lin, "An Efficient Heuristic For Partitioning Graphs," BSTJ 49 (1970), 291308. L73. S. Lin and B. W. Kernighan, "An Effective Heuristic Algorithm for the Traveling-Salesman Problem," BSTJ 21 (1973), 498-516. 072. G. I. Orlova and Y. G. Dorfman, "Finding the Maximum Cut in a Graph, ' Eng. Cybernetics I0 (1972), 502-506. Sa72. S. Sahni, "Some Related Problems From Network Flows, Game Theory, and Integer Programming," SWAT (1972), 130-138. Sa73. S. Sahni, On the Knapsack and Other Computationally Related Problems, Doctoral thesis, Cornell University (1973) • Se73. R. Sethi, "Complete Register Allocation Problems," STOC (1973), 182-195. St73. L. Stockmeyer, "Planar 3-Colorability is Polynomial Complete," SIGACT News 5, No. 3 (1973), 19-25. U73. J. D. Ullman, "Polynomial Complete Scheduling Problems," 4th Symp. on Operating System Principles (1973), 96-101.