Complexity of Recognizing Equal Unions in Families of Sets

Complexity of Recognizing Equal Unions in Families of Sets

Journal of Algorithms 37, 495–504 (2000) doi:10.1006/jagm.2000.1121, available online at http://www.idealibrary.com on Complexity of Recognizing Equa...

87KB Sizes 1 Downloads 45 Views

Journal of Algorithms 37, 495–504 (2000) doi:10.1006/jagm.2000.1121, available online at http://www.idealibrary.com on

Complexity of Recognizing Equal Unions in Families of Sets David P. Jacobs Department of Computer Science, Clemson University, Clemson, South Carolina 29634 E-mail: [email protected]

and Robert E. Jamison Department of Mathematical Sciences, Clemson University, Clemson, South Carolina 29634 E-mail: [email protected] Received October 29, 1999

A family of sets has the equal union property if there exist two nonempty disjoint subfamilies having equal unions and has the full equal union property if, in addition, all sets are included. Both recognition problems are NP-complete even when restricted to families for which the cardinality of every set is at most three. Both problems can be solved in polynomial time when restricted to families having a bounded number of sets with cardinality greater than two. A corollary is that deciding if a graph has two disjoint edge covers is in P. © 2000 Academic Press Key Words: hypergraphs; equal union; L-matrices; edge cover.

1. INTRODUCTION Let F = S1      Sm  be a family of nonempty subsets of a finite set V . We say that F has the equal union property (EUP) if and only if there exist nonempty disjoint sets   ⊆ 1     m, for which   Sγ = Sδ  (1) γ∈

δ∈

A variant of this is to require that the unions in (1) also equal V , in which case we say F has the full equal union property, denoted FEUP. The use of 495 0196-6774/00 $35.00 Copyright © 2000 by Academic Press All rights of reproduction in any form reserved.

496

jacobs and jamison

the word family, of course, implies the sets are distinct. However, if Si = Sj for i = j, then trivially (1) holds by taking  = i and  = j. Lindstr¨ om appears to have been the first to consider the equal union property. In [10], using combinatorial methods, he gave a sufficient condition for r equal unions. In [14] Tverberg gave an algebraic proof of Lindstr¨ om’s results. From Lindstr¨ om’s theorem it follows that ¨ m). Any family of at least k + 1 nonempty sets Theorem 1 (Lindstro whose union has k elements has the equal union property. Let F = S1      Sm where each Si ⊆ V = x1      xn . The incidence matrix of F is the n × m matrix M = mij of zeroes and ones in which mij = 1 if and only if xi ∈ Sj . The degree of xi , written degxi , is the number of sets containing it. Note that the number of 1’s in column j is the cardinality of Sj , and the number of 1’s in row i is the degree of xi . The equal union property is intimately connected with so-called Lmatrices. A real n × m matrix is an L-matrix if and only if the columns of every real n × m matrix having the same sign-pattern are linearly independent. In [5] it was shown that a family F = S1      Sm of nonempty subsets of V = x1      xn  has the EUP if and only if its incidence matrix M is not an L-matrix. Square L-matrices are called sign-nonsingular [11]. In recent papers [12, 13] McCuaig, Robertson, Seymour, and Thomas showed that many related problems, including the recognition of sign-nonsingular matrices, can be done in polynomial time. It follows that for families of n sets on n points, the EUP can be recognized in polynomial time. Recognizing graphs having two disjoint total dominating sets is NPcomplete [7]. By considering the family of open neighborhoods in the graph, this implies the surprising result that recognizing the full equal union property in n sets on n points is NP-complete. Thus, the complexity of the n × n case is settled. Our paper is concerned with the complexity of recognizing the EUP and FEUP in the general case of n points and m sets. In [8], Klee et al. showed that recognizing non-L-matrices, and hence the equal union property, is NP-complete. In fact, it can be shown that the decision problems for the EUP and the FEUP are NP-complete, even when restricted to very specialized families having only sets of cardinality two and three and points of degree two and three. However, as shown in Theorem 2, if we bound the number of sets whose cardinality exceeds two, both decision problems can be solved in polynomial time. To prove this, we must consider a new combinatorial object we call a vest. It will sometimes be more descriptive to speak of a hypergraph H = V F rather than a family of sets. Here V is the set of points (or vertices) and F

equal unions

497

is the family of subsets (or edges).1 By a balanced coloring of H we mean an assignment of either red or blue to each edge in such a way that every vertex lies in at least one edge of both colors. Clearly the existence of a balanced coloring is equivalent to the FEUP. We use graph only when all edges have cardinality two. Recall for a graph G = V E , S ⊆ E is an edge cover if every v ∈ V is incident with some member of S. The smallest cardinality of an edge cover in G is denoted α1 G . A classic result on edge covers is Gallai’s theorem that says that for a graph G on n vertices, α1 G + β1 G = n, where β1 denotes the matching number [3]. An analogous result of Gallai’s links the vertex cover and independence numbers α0 and β0 . These theorems have led to other similar results and generalizations (see [1]). Computing α1 G can be done in polynomial time [9]. Note that for graphs, the FEUP is equivalent to having two nonempty disjoint edge covers. An interesting outcome of our present work is that for graphs both the EUP and the FEUP can be recognized in polynomial time (see Lemmas 4 and 6). One might ask about deciding if a graph has three disjoint equal unions. But in [4], Holyer showed that recognizing 3-edge-colorable graphs is NP-complete, even for connected cubic graphs. It is easy to see that in connected cubic graphs, 3-edge-colorability is equivalent to having three disjoint full equal unions. And in a connected cubic graph, three disjoint edge sets covering the same set of vertices must cover all vertices. (Otherwise, there would be an edge from a covered vertex v to an uncovered vertex, leaving v covered by only two edges.) It follows that recognizing three disjoint (full) equal unions is NP-complete, even for cubic graphs.

2. VESTS Our goal is to prove Theorem 2. Let us agree that an edge is big if it has cardinality greater than two. A look ahead at the proof of Theorem 2 reveals that the problem for hypergraphs having b big edges easily reduces to the cases when b = 1 2. Thus it will be useful to first consider a special case of the problem. A vest is a quadruple V E S T in which

1

(i)

V E is a nonempty, connected graph,

(ii)

S and T are subsets of V , and

(iii)

all degree one vertices in V E lie in S ∪ T .

We will assume that ∈ F, although we allow V or F to be empty. Note that a necessary condition for an equal union is that F ≥ 2 and V = .

498

jacobs and jamison

We allow degeneracies: V could consist of a single point with E empty and either S or T can be empty, singleton, or equal. The only restriction is that V cannot be empty. The sets S and T will be called big edges regardless of their cardinality, and the edges in E will be called small edges. A vest coloring of a vest is an assignment f  E ∪ S T  → red, blue such that (i)

S is red and T is blue, and

(ii)

every v ∈ V lies in at least one edge of both colors.

Note that vest colorings are balanced colorings in which the two big edges are colored opposite. Vests having vest colorings will be called colorable. A vest W F P Q is a subvest of a vest V E S T provided W ⊆ V , F ⊆ E, P ⊆ S, and Q ⊆ T . Lemma 1. Any coloring of a subvest can be extended to a coloring of the whole vest. Proof. Assume W F P Q is a subvest of V E S T having a vest coloring. Without loss of generality, we may assume that W is a maximal vertex set for which there is a colorable subvest. It suffices to show V = W . Suppose s lies in W ∩ S but not in P. Since s ∈ W , it lies in edges of both colors in the subvest. Adding s to P will make P ∪ s an extra red edge at s, so the coloring remains balanced. So without loss of generality we may assume P = W ∩ S and Q = W ∩ T . Now suppose s ∈ S − W . Since V E is connected, there is a path from s to W . Let w be the first node of W encountered on this path. Color the edge of this path at s the color blue, and alternate the colors after that. Then when the new vertices and edges of the path are added to W and F a larger subvest with a vest coloring is created. Hence we may assume S ⊆ W and T ⊆ W . Now suppose v ∈ V − W . Again form a path from v to a point w of W . Starting at w, walk this path back to v. Since v ∈ W , we know v ∈ S ∪ T , so degv > 1. Thus there is another edge at v. Adjoin this edge to the path. Continue in this way until either a point of W is reached or a point of the path is met a second time. Now alternately color these new edges red and blue. At the end node(s) of this construction in W , there are already edges of both colors in W . If the construction loops around, then at that point there are two consecutive edges which get different colors, so the color of the final edge is irrelevant. We have extended the vest coloring, contradicting the maximality of W , so it follows that V = W .

equal unions

499

FIG. 1. Equal union but no full equal union.

Corollary 1. A connected graph with minimum vertex degree two has the EUP if and only if it has the FEUP. Proof. Suppose G = V E has the EUP. Since there are no degree-1 vertices, V E  is a vest. Since G has the EUP, some subvest has a vest coloring. By Lemma 1, we can extend this coloring to the entire graph. Figure 1 shows that the corollary fails even for families having only one set of size greater than two. Lemma 2. A vest V E S T has a vest coloring if and only if at least one of the following conditions is met: (i)

S ∩ T = ,

(ii)

E ≥ V + 1,

(iii)

E = V and S ∪ T = ,

(iv)

E = V and V is even,

(v)

E = V − 1 and there are two nodes in S an odd distance apart,

(vi)

E = V − 1 and there are two nodes in T an odd distance apart,

(vii) E = V − 1 and there is a node in S an even distance from a node in T . Proof. First, we show that each of these conditions provides a seed from which a vest coloring can be grown using Lemma 1. (i) If v ∈ S ∩ T , then v  v v is a subvest with a trivial vest coloring. (ii) If E ≥ V + 1, then by Theorem 1 V E has equal unions ∪A = ∪B for some A B ⊆ E. If F = A ∪ B and W is the vertex set covered by F, then W F  is a subvest with a vest coloring. (iii) Suppose E = V and S = . Then E ∪ S, by Theorem 1, is a family of sets having the equal union property. If V E has the EUP then

500

jacobs and jamison

we may use the reasoning in the previous case and we are done. So we may assume S is used. Let F be the set of edges in E which occur in the equal union, and let W be the set of vertices they cover. Then it is easy to see that W F S is a subvest with a vest coloring. (iv) Since V E is connected and E = V , it follows that V E is a tree with a single extra edge (a so-called unicyclic graph). If V E has a degree 1 vertex, then by the definition of a vest it lies in S ∪ T , and the previous condition applies. So without loss of generality, we may assume V E has no degree 1 vertices, and so V E is just a cycle. Since V is even, there is an equal union. (v) Suppose p and q are vertices of S for which a shortest path from p to q has an odd number of edges. Let W and F, respectively, be the vertices and edges in this path. Starting at one end and alternately coloring the edges blue and then red will result in both end-edges colored blue. Taking p q to be the big red edge yields a vest coloring of the subvest W F p q . (vi)

This case is similar to the previous case.

(vii) Suppose p ∈ S and q ∈ T and there is a shortest path from p to q having an even number of edges. Let W and F, respectively, be the vertices and edges in this path. Starting at p, we color the edges in the path, alternately blue and red. Now, taking p as the big red edge and q as the big blue edge, we see that the subvest W F p q has a vest coloring. We now turn to the converse. Suppose V E S T has a vest coloring. By contradiction, assume that all seven conditions fail. Then by (ii), we know E ≤ V . If E = V then since V E is connected, it must be a unicyclic graph. Since S and T are both empty by (iii), the definition of a vest guarantees that V E can have no degree 1 vertices. So V E is a cycle. By (iv) it must be an odd cycle. This is impossible since an odd cycle does not admit a balanced coloring. Hence E ≤ V − 1. Since V E is connected, E ≥ V − 1. Thus the only case left to consider is E = V − 1, in which case V E is a tree. Since V is nonempty, it has at least one vertex. If there were only one vertex, the vest must be of the form v  v v , satisfying (i), so there must be an edge. Hence there is at least one degree-1 vertex v. Then v ∈ S ∪ T . Without loss of generality assume v ∈ S. If v ∈ T then (i) is satisfied, so assume v ∈ T . Since there is a vest coloring, there must be a small blue edge incident with v. The other vertex in this edge must be incident with a red edge. Because (v) fails, this is a small red edge. Because (v) and (vii) fail, we can build a path of alternating colors, starting at v and ending at some other degree 1 vertex w. Since w must be incident with both colors, it must be in a big

equal unions

501

edge. If w ∈ S, then w must be incident to a small blue edge, and the path from v to w is odd. On the other hand, if w ∈ T , then w is incident to a small red edge and the path has even length. In either case, (v) or (vii) is satisfied. Lemma 3. Deciding if a vest has a vest coloring can be done in polynomial time. Proof. time.

Each of the conditions in Lemma 2 can be checked in polynomial

3. A BOUNDED NUMBER OF BIG EDGES In this section we give a polynomial time algorithm to recognize the EUP and FEUP for hypergraphs in which all but a bounded number of edges have cardinality at most two. If H = V E is a hypergraph containing a vertex v of degree 0, we may remove v to obtain a new hypergraph H  . Clearly H  has the EUP if and only if H does. Similarly, if some S ∈ E contains a vertex of degree 1, H  = V E − S has the EUP if and only if H does. This last operation could introduce new degree 0 vertices. However, if we keep repeating these operations, eventually we will obtain a hypergraph all of whose vertices have degree at least two. Lemma 4. For hypergraphs having all edges with cardinality ≤ 2, the EUP can be recognized in polynomial time. Proof. Let H be such a hypergraph. By the remark above, we may assume every vertex has degree at least two. Let M be the n × m incidence matrix. Each row in M has at least two 1’s. Each column has at most two 1’s. Let j be the number of ones in M. It follows that 2n ≤ j ≤ 2m, so n ≤ m. If n < m then we are done by Theorem 1, so assume n = m. Then M has exactly two 1’s in every row and in every column, and so H is a graph in which all vertices have degree two. Therefore H is a disjoint union of cycles. It is easy to see that H has the EUP if and only if at least one cycle is even. Corollary 2. Deciding if a graph contains two nonempty sets of edges covering the same set of vertices can be done in polynomial time. Lemma 5. A hypergraph has the EUP if and only if some connected component has the EUP and it has the FEUP if and only if all connected components have the FEUP. Lemma 6. For hypergraphs having all edges with cardinality ≤ 2, the FEUP can be recognized in polynomial time.

502

jacobs and jamison

Proof. Let H be such hypergraph. By Lemma 5 we may assume H is connected. If any point in H has degree < 2, then H does not have the FEUP. Otherwise, H is a connected graph, and so by Corollary 1 the question is equivalent to whether H has the EUP, which, by Lemma 4, has a polynomial time solution. Corollary 3. Deciding if a graph has two nonempty disjoint edge covers can be done in polynomial time. Gabow [2] has given the following alternate proof of Corollary 3. For a graph G = V E and F ⊆ E, let degF v denote the degree of v in F. Note that F is an edge cover if and only if degF v ≥ 1 for all v ∈ V . Furthermore, G has two disjoint edge covers if and only if for some F, 1 ≤ degF v < degE v for all v ∈ V . This is an instance of a degreeconstrained subgraph problem, which can be solved in polynomial time [6, pp. 388–389]. Lemma 7. Let H = V E ∪ S be a connected hypergraph in which G = V E is a graph having components Gi = Vi  Ei , i = 1    k, and for which all degree-1 vertices (of G) lie in S. For each i, let Si = Vi ∩ S. The following are equivalent: (i) H has an equal union involving S. (ii) Each Vi  Ei  Si  is a vest having a colorable subvest. (iii) Each Vi  Ei  Si  is a colorable vest. (iv) Proof.

H has a full equal union involving S. (Sketch)

i ⇒ ii: By the assumption on degree-1 vertices, each Vi  Ei  Si  is a vest. Since H is connected, we have Si = for each i. Thus the equal union on H must induce a coloring on some subvest of Vi  Ei  Si  . ii ⇒ iii: iii ⇒ iv: is easy to see iv ⇒ i:

This follows from Lemma 1. Since each component has a full equal union involving Si , it how this gives a full equal union on H involving S. This is obvious.

Lemma 8. Let H = V E ∪ S T  be a connected hypergraph in which G = V E is a graph having components Gi = Vi  Ei , i = 1    k, and for which all degree-1 vertices (of G) lie in S ∪ T . For each i, let Si = Vi ∩ S and Ti = Vi ∩ T . The following are equivalent: (i)

H has an equal union involving S and T in opposite subfamilies.

(ii)

Each Vi  Ei  Si  Ti is a vest having a colorable subvest.

(iii)

Each Vi  Ei  Si  Ti is a colorable vest.

equal unions

503

(iv) H has a full equal union involving both S and T in opposite subfamilies. Proof. The proof is similar to that of Lemma 7. Note that since H is connected, for each i, Si = or Ti = . Lemma 9. For hypergraphs H = V E ∪ S , where G = V E is a graph, both the EUP and the FEUP can be recognized in polynomial time. Proof. For purposes of an algorithm, by Lemma 5, we may assume H is connected. We can also assume that every degree-1 vertex in G lies in S, since otherwise it would have degree-1 in H and hence could not be used in any equal union. However, we cannot assume G is connected. We can check if G has the EUP using Lemma 4, and we can use Lemma 6 to decide if G has the FEUP. If G does not have the desired property, then we know that an equal union or full equal union will require the use of S. By Lemma 7 H has the EUP and the FEUP if and only if each of the vests Vi  Ei  Si  is colorable. By Lemma 3 the proof is complete. Lemma 10. For hypergraphs H = V E ∪ S T  , where G = V E is a graph, both the EUP and the FEUP can be recognized in polynomial time. Proof. As before, we assume that H is connected and all degree-1 vertices of G lie in S ∪ T . Again, we first check if the equal union properties can be achieved using just small edges of G. If not, we consider the problem of using just one big edge, say S. By Lemma 9 this can be done in polynomial time. If this fails, we apply Lemma 9 again, but this time using T . If this fails, we try S ∪ T . If this fails, we know that we will have an equal union if and only if we use both S and T with opposite colors. Lemmas 8 and 3 complete the proof. Lemma 11. Let H = V F be a hypergraph containing a one-element edge a. Let H  be the hypergraph obtained by replacing a with a x, x y, y a where x and y are new points. Then H has the ( full) equal union property if and only if H  has the ( full) equal union property. Theorem 2. For each fixed b, there is a polynomial time algorithm to recognize the EUP and FEUP for hypergraphs having at most b edges of cardinality greater than two. Proof. Let H = V F , where F = E ∪ S1      Sb , each Si ≥ 3, and

e ≤ 2 for each e ∈ E. By Lemma 11 we may assume each e = 2, so that V E is a graph. By Lemmas 4 and 6, we may first determine if V E has the EUP and FEUP. If not, for each nonempty subset I ⊆ 1     b, we let S = ∪i∈I Si , and we check if H = V E ∪ S has the EUP and FEUP using Lemma 9. If this test fails, then for every two disjoint nonempty subsets I J ⊆ 1     b, we let S = ∪i∈I Si and T = ∪j∈J Sj . We then apply

504

jacobs and jamison

Lemma 10 to H = V E ∪ S T  . This method is polynomial time since b is fixed. REFERENCES 1. E. J. Cockayne, S. T. Hedetniemi, and R. Laskar, Gallai theorems for graphs, hypergraphs, and set systems, Discrete Math. 72 (1988) 35–47. 2. H. Gabow, private communication. ¨ 3. T. Gallai, Uber extreme Punkt-und Kantenmengen, Ann. Univ. Sci. Budapest, E¨ otv¨ os Sect. Math. 2 (1959), 133–135. 4. I. Holyer, The NP-completeness of edge-coloring, SIAM J. Comput. 10 (1981), 718–720. 5. D. P. Jacobs and R. E. Jamison, A note on equal unions in families of sets, Discrete Math. to appear. [Special issue in honour of Helge Tverberg]. 6. L. Lov´asz and M. D. Plummer, “Matching Theory,” Annals of Discrete Mathematics, Vol. 29, North-Holland, Amsterdam, 1986. 7. D. P. Jacobs, R. E. Jamison, and A. A. McRae, On the complexity of sign-nonsingularity and equal unions of sets, in “Proceedings of the 38th ACM SE Conference, Clemson, April 2000,” pp. 232–234. 8. V. Klee, R. Ladner, and R. Manber, Signsolvability revisited, Linear Algebra Appl., 59 (1984), 131–157. 9. E. L. Lawler, “Combinatorial Optimization: Networks and Matroids,” Holt, Rinehart, and Winston, New York, 1976. 10. B. Lindstr¨ om, A theorem on families of sets, J. Combin. Theory Ser. A 13 (1972), 274–277. 11. T. J. Lundy, J. Maybee, and J. Van Buskirk, On maximal sign-nonsingular matrices, Linear Algebra Appl. 247 (1996), 55–81. 12. W. McCuaig, N. Robertson, P. D. Seymour, and R. Thomas, Permanents, Pfaffian orientations, and even directed circuits (Extended abstract), in “Proc. 1997 Symposium on the Theory of Computing (STOC),” 1997. 13. N. Robertson, P. D. Seymour, and R. Thomas, Permanents, Pfaffian orientations, and even directed circuits, Ann. of Math., to appear. 14. H. Tverberg, On equal unions of sets, in “Studies in Pure Mathematics” (L. Mirsky, Ed.), pp. 249–250, Academic Press, London, 1971.