Listing all minimal separators of a graph - CiteSeerX

14 downloads 0 Views 189KB Size Report
An e cient algorithm listing all minimal vertex separators of an undirected graph is given. The algorithm needs polynomial time per separator that is found.
Listing all minimal separators of a graph ? T. Kloks1 ?? and D. Kratsch2 1

Department of Mathematics and Computing Science Eindhoven University of Technology P.O.Box 513 5600 MB Eindhoven, The Netherlands 2 Fakultat fur Mathematik und Informatik Friedrich-Schiller-Universitat Universitatshochhaus 07740 Jena, Germany

Abstract. An ecient algorithm listing all minimal vertex separators of an undirected graph is given. The algorithm needs polynomial time per separator that is found.

1 Introduction Given a graph, one is often interested in listing certain subsets of vertices, or their cardinality, which possess a certain property. For example the clique number of a graph G is the maximum cardinality of a subset S such that G[S] is complete. Similar questions are the independence number, the domination number or the chromatic number. For many of these problems, it would be convenient if one could use a decomposition of the graph by means of certain separators . This is perhaps best illustrated by the recent results for classes of graphs of bounded treewidth. For these classes, linear time algorithms exist for many NP-complete problems exactly because a decomposition can be made using separators of bounded size [1, 2, 3, 4, 12]. A decomposition of this type can be found in linear time [5, 12], however the huge constants involved in these algorithms do not make them of much practical use. A closely related, but somewhat di erent approach was surveyed in [19]. In this paper (see also [8]) it is shown that for many classes of graphs (for example chordal graphs, clique separable graphs and edge intersection graphs of paths in a tree or EPT-graphs) a decomposition by clique separators is possible, and it is illustrated that such a decomposition can also be used to solve eciently many NP-complete problems like minimum fill-in, maximum clique, graph coloring and maximum independent set. In [20] an algorithm is given for nding clique separators eciently (the algorithm uses O(nm) time to nd one clique separator). Recent results have shown how the above mentioned results can be generalized in the sense that at least the NPcomplete problems treewidth and minimum fill-in can be solved by polynomial This paper also appeared in: Proceedings of the 11th Annual Symposium on Theoretical Aspects of Computer Science, Springer, Lecture Notes in Computer Science, 775, pp. 759{ 768. ?? Email: [email protected]. ?

time algorithms for much more graph classes, i.e., certain graph classes for which the number of minimal separators is polynomial bounded, ([6, 7, 12, 13, 14, 15, 17]). In [11] an algorithm is given which nds all, what the authors call minimum size separators . By this they mean that given a graph which is k-connected, the algorithm nds all separators with k vertices. Moreover, they show in this paper that the number of these separators is bounded by O(2k nk2 ). Their algorithm which lists all minimum size separators runs in O(2k n3) time. We call a subset of vertices S a minimal separator if there are non adjacent vertices x and y such that the removal of S separates x and y into disjoint connected components in such a way that no proper subset of S also does this (see De nition 1). A closely related concept which we call inclusion minimal separators lies more or less between the minimum size separators and the minimal separators, i.e., all minimum size separators are inclusion minimal and all inclusion minimal separators are minimal separators. The following example shows that the minimum size separators and the inclusion minimal separators are only of limited use. Consider any graph G. Take a new vertex x and make this adjacent to all vertices of G. Take another new vertex y and make this adjacent to x. Call this new graph H. The only inclusion minimal separator which is also the only minimum size separator of H is fxg. However if S is some minimal separator of G, then S [ fxg is a minimal separator in H. Hence H has at least as many minimal separators as G. In [6, 12, 13, 14, 15] it is shown that many important classes of graphs have a polynomial number of minimal vertex separators. These graph classes include permutation graphs, circular permutation graphs, trapezoid graphs, circle graphs, circular arc graphs, distance hereditary graphs, chordal bipartite graphs, cocomparability graphs of bounded dimension and weakly triangulated graphs. For some of these graph classes there are ecient algorithms listing all minimal vertex separators, often using so-called `scanlines' (see e.g. [6, 12, 17]). In this paper we present an algorithm for listing all minimal vertex separators of any given graph. Notice that, in general, the number of minimal separators can be exponential, as the following example shows. Consider the graph consisting of two non adjacent vertices s and t, and a set of n?2 2 (internally) vertex disjoint paths of length 3 from s to t. The number of minimal s; t-separators in this graph is 2(n?2)=2. Our listing algorithm has been applied as an important subroutine in O(n5 R+n3R3) algorithms computing the treewidth and minimum ll-in of a given asteroidal triple-free graph with n vertices and R minimal separators [16, 17]. (Notice that asteroidal triplefree graphs are a relatively large class of graphs containing cocomparability graphs and permutation graphs.) Furthermore it has been suggested in [18] to use a so-called `separator graph' for obtaining polynomial time treewidth and minimum ll-in algorithms. Thereby the vertex set of the separator graph is the set of all minimal separators of the given graph. Typically applications require our listing algorithm. For listing other types of combinatorial structures we refer to [9].

2 Preliminaries If G = (V; E) is a graph and W  V a subset of vertices then we use G[W] as a notation for the subgraph of G induced by the vertices of W. For a vertex x 2 V we use N(x) to denote the neighborhood of x. 2

The following de nition can be found for example in [10]. De nition1. Given a graph G = (V; E) and two non adjacent vertices a and b, a subset S  V is an a; b-separator if the removal of S separates a and b in distinct connected components. If no proper subset of S is an a; b-separator then S is a minimal a; b-separator. A minimal separator is a set of vertices S for which there exist non adjacent vertices a and b such that S is a minimal a; b-separator. The following lemma appears for example as an exercise in [10]. It provides an easy test whether a given set S of vertices is a minimal separator or not. Lemma 2. Let S be a separator of the graph G = (V; E). Then S is a minimal separator if and only if there are two di erent connected components of G[V ? S] such that every vertex of S has a neighbor in both of these components. Proof. Let S be a minimal a; b-separator and let Ca and Cb be the connected components containing a and b respectively. Let x 2 S. Since S is a minimal a; b-separator, there is a path between a and b passing through x but using no other vertex in S. Hence x must have a neighbor in Ca and in Cb. Now let S be a separator and let Ca and Cb be two connected components such that every vertex of S has a neighbor in Ca and in Cb . Let a 2 Ca and b 2 Cb. Then clearly S is a minimal a; b-separator, for if x 2 S, then there is a path between a and b which uses no vertices of S n fxg. ut Notice that this also proves the following. Let S be a minimal separator and let C1 and C2 be two connected components of G[V ? S] such that every vertex of S has a neighbor in both C1 and C2. If a is a vertex of C1 and b is a vertex of C2 then S is a minimal a; b-separator. It may be a bit surprising at rst sight that it is very well possible for one minimal separator to be contained in another one. An example of this can be found in [10]. However, for minimal a; b-separators things are di erent, since by de nition one minimal a; b-separator cannot be properly contained in another one. We now show that at least some of the minimal separators are easy to nd. De nition3. Let a and b be non adjacent vertices. If S is a minimal a; b-separator which contains only neighbors of a then S is called close to a. Lemma 4. If a and b are non adjacent then there exists exactly one minimal a; bseparator close to a. Proof. Let S be a minimal a; b-separator close to a. For every vertex in S there is a path to b which does not use any other neighbors of a, since S is minimal. On the other hand, if x is a neighbor of a such that there is a path to b without any other neighbors of a, then x must be an element of S, otherwise there is a path between x and b which avoids S and this is a contradiction since x is in the component of G[V ? S] that contains a. ut Notice that a minimal separator close to a can easily be computed as follows. Start with S = N(a). Clearly, since a and b are non adjacent S separates a and b. Let Cb be the connected component of G[V ? S] containing b. Let S 0  S be the set of those vertices of S which have at least one neighbor in Cb. By Lemma 2 S 0 is a minimal a; b-separator, and since it only contains neighbors of a, it is close to a. 3

Lemma 5. Let S be a minimal a; b-separator close to a and let Ca and Cb be the connected components containing a and b respectively. Let S  6= S be another minimal a; b-separator. Then S   S [ Cb. Proof. Since S  is a minimal a; b-separator S   Ca [ Cb [ S. Assume S  has a vertex

x 2 Ca . S  n fxg does not separate a and b hence there is a path P between a and b using x but no other vertex of S  . Since S is a minimal separator, P goes through a vertex y 2 S. Since S is close to a, y is adjacent to a. Hence there is a path P 0  P between a and b that does not contain x. This is a contradiction since P 0 contains no vertex of S  . ut In the next two sections we show how to obtain new minimal a; b-separators from a given one using so called minimal pairs. A minimal pair is in some sense the smallest step to go from one minimal a; b-separator to the next one. The main diculty is to prove that we indeed obtain all minimal separators by using small steps only. In section 5 we describe an algorithm that computes all minimal a; b-separators for a given pair of non adjacent vertices a and b in a breadth- rst-search manner, we prove that it is correct and we analyse its time complexity. We end with some concluding remarks and some open problems.

3 Good pairs Let G = (V; E) be a graph and let a and b be non adjacent vertices in G. Let S be a minimal a; b-separator and let Ca and Cb be the connected components containing a and b respectively. De nition6. Let   Ca n fag and let Ca0 be the connected component of G[Ca ? ] that contains a. Let N  S be the set of vertices in S that do not have a neighbor in Ca0 . The pair (; N) is called good for S if the following conditions are satis ed. 1. N 6= ;. 2. Each  2  has at least one neighbor in Ca0 . 3. Each  2  either has a neighbor in N or there exists a vertex x 2 N and a connected component D of G[Ca ? ] such that both x and  have at least one neighbor in D. Lemma 7. If S is close to a then there is no good pair. Proof. Assume (; N) is a good pair. Hence   Ca n fag. Let Ca0 be the connected component of G[Ca ? ] that contains a. The set N is de ned as the subset of S that does not contain any neighbor in Ca0 . Then N = ; since S contains only neighbors of a. But by de nition N 6= ;. ut Theorem 8 shows that a good pair de nes a new separator. In Theorem 9 we show that each minimal a; b-separator can be obtained by a good pair for the separator that is close to b. In section 4 we show that only a restricted type of good pairs, called minimal pairs, have to be considered. Theorem 8. Let (; N) be a good pair. De ne S  = (S [ ) n N . Then S  is a minimal a; b-separator. 4

Proof. Let Ca0 be the connected component of G[Ca ? ] that contains a. Clearly, S 

separates a and b, since vertices of N do not have neighbors in Ca0 . Let Cb0 be the connected component of G[V ? S  ] that contains b. Notice that Cb  Cb0 , and since each vertex of N has a neighbor in Cb, N  Cb0 . Each vertex of S  has at least one neighbor in Ca0 by de nition of a good pair, and each vertex of S  n  has at least one neighbor in Cb0 since it has at least one neighbor in Cb. The only thing left to show is that each vertex of  has a neighbor in Cb0 . Let  2 . By de nition, either  has a neighbor in N (and hence in Cb0 ) or there is a vertex x 2 N and a connected component D of G[Ca ? ] such that both  and x have a neighbor in D. D is also connected in G[V ? S  ] and since x has a neighbor in D, D  Cb0 . ut Theorem 9. Assume S is close to b. Let S  6= S be a minimal a; b-separator. There exists a good pair (; N) such that S  = (S [ ) n N . Proof. Let Ca and Cb be the connected components of G[V ? S  ] containing a and b respectively. First notice that S   Ca [ Cb [ S, since S  is minimal. Since S is close to b, by Lemma 5, S   S [ Ca . Let  = S  \ Ca and N = S n S  . We show that (; N) is a good pair. Since S  6= S and both are minimal a; b-separators: N 6= ;. Let Ca0 be the connected component of G[Ca ? ] containing a. We show that N is exactly the set of vertices in S which do not have a neighbor in Ca0 . In order to do this we claim that Ca0 = Ca . Since Ca0 is a connected component of G[V ? ( [ S)] and since S    [ S, Ca0  Ca. Now assume there is a vertex x 2 N which has a neighbor y 2 Ca0 . Since S is close to b, x is a neighbor of b. This is a contradiction since there would be a path between a and b which does not use any vertex of S  . This shows that Ca0 = Ca . Since S  is minimal, N is exactly the set of vertices in S that do not have a neighbor in Ca0 , and every vertex of  [ (S n N) has at least one neighbor in Ca0 . To prove the last item rst notice that N  Cb and that Cb contains exactly those connected components D of G[Ca ? ] for which there is a vertex y 2 N which has a neighbor in D. Now let  2 . Since Sa is minimal,  has a neighbor x in Cb . Since  only has neighbors in Ca [ S, x must be an element of N or of some component D of G[Ca ? ]. In this second case, there must also be a vertex y 2 N which has a neighbor in D. ut

4 Minimal pairs Again let G = (V; E) be a graph and let a and b be non adjacent vertices in G. Let S be a minimal a; b-separator and let Ca and Cb be the connected components of G[V ? S] containing a and b respectively. In this section we show how to nd some good pairs. De nition10. Let x 2 S be non adjacent to a. Let Ca (x) be the subgraph induced by Ca [ fxg. Let  be the minimal x; a-separator in Ca (x) close to x, and let Ca0 be the connected component containing a. Now let N be the set of vertices of S which do not have a neighbor in Ca0 . The pair (; N) is called the minimal pair for S and x.

Lemma 11. A minimal pair is good. 5

Proof. Notice that x 2 N, hence N 6= ;.

Now,  is a minimal x; a-separator in Ca (x) and hence every vertex of  has a neighbor in Ca0 . Finally, if  2  then  is adjacent to x since  is close to x. Hence each vertex of  has a neighbor in N. ut We want to prove that we can nd every minimal a; b-separator by starting with the minimal a; b-separator that is close to b and by recursively using minimal pairs. The following technical lemma proves this.

Lemma 12. Let (; N) be a good pair for S. Let x 2 N and let (; N ) be the minimal pair for S and x. Let S  = (S [ )nN  . De ne  = n and N = (N nN  )[( n). Then:

1. if N = ; then (S [ ) n N = S  , and if 6 ; then (; N) is a good pair for S  and (S [ ) n N = (S  [ ) n N . 2. N = Proof. We start with some easy observations. Let Ca0 be the connected component of

G[Ca ? ] that contains a and let Ca be the connected component of G[Ca ?  ] that contains a. Let 0 = N(x) \ .

Ca0  Ca since  contains no vertices of Ca0 . 0   since every vertex of 0 has a neighbor in Ca0 .  n 0  Ca since every vertex of  has a neighbor in Ca0 . N   N, since Ca0  Ca . Ca0 is exactly the connected component of G[Ca ? ( n 0)] containing a since Ca ? ( n 0 ) contains all vertices of Ca0 but no vertex of . { The set of vertices in S  without a neighbor in Ca0 is exactly N, which is easy to check.

{ { { { {

Assume N = ;. Then    and N = N  (since N   N). Now clearly, also   = , otherwise S  and (S [ ) n N are two minimal a; b-separators of which one is properly contained in the other which is impossible. Hence S  = (S [ ) n N. Now assume N 6= ;. We show that (; N) is good for S  . Notice that every vertex of  has a neighbor in Ca0 , since this holds for every vertex of . Let  2  and assume that  has no neighbors in N. Since  2 Ca,  has no neighbor in N  . Hence  has no neighbor in N. Now (; N) is a good pair, hence there is a vertex z 2 N and a connected component D of G[Ca ? ] such that  and z have a neighbor in D. Assume by way of contradiction that for no vertex of N there is a connected component in G[Ca ? ] such that this vertex and  both have a neighbor in this component. The following observations lead to a contradiction.

{ N() \ D  Ca . Otherwise, since  n 0  N,  has a neighbor in N. { G[D ? ] is connected. Since otherwise every connected component has a vertex with a neighbor in  n , and hence there is a connected component and some vertex in N such that this vertex and  both have a neighbor in this component.

{ D contains no vertices of  , by the same argument. 6

This shows that D  Ca . If z 2 N  then z can have no neighbors in D, since z has no neighbors in Ca . Hence z 2 N n N  . This is a contradiction, since now there is a connected component D in G[Ca ? ] and a vertex z 2 N such that z and  both have a neighbor in D. The fact that (S [ ) n N = (S  [ ) n N is obvious. ut Starting with the minimal separator close to b, Theorem 9 ensures that a good pair (; N) exists for every minimal separator. If, at one point, we arrived at a minimal separator S, Lemma 12 shows that we can nd the minimal separator (S [ ) n N by successively choosing minimal pairs ( ; N ). Notice that the component of S  containing a is smaller than the component of S containing a. Hence, after a nite number of steps we reach (S [ ) n N. Consequently we obtain the following result.

Corollary13. Let S be a minimal a; b-separator and let S be the minimal a; b-separator 1

close to b. There exists a sequence (1; N1 ); : : :; (t; Nt ) such that

1. (1; N1) is a minimal pair for S1 and some vertex x1 2 N1 . 2. For i = 2; : : :; t, (i; Ni ) is a minimal pair for Si = (Si?1 [ i?1) n Ni?1 and some vertex xi 2 Ni . 3. For i = 1; : : :; t, i and a are in the same connected component of G[V ? Si ]. 4. S = (St [ t) n Nt .

5 An algorithm listing minimal separators In this section we give an algorithm that, given a graph G and two non adjacent vertices a and b nds all minimal a; b-separators. This algorithm is displayed in gure 1.

Theorem 14. Let S be the minimal a; b-separator that is close to b and let T = fSg and Q = fS g. Then a call separators(G; a; b; T ; Q) determines a set Q containing all minimal a; b-separators. Proof. By Corollary 13 the set Q contains all minimal a; b-separators. By Lemma 11

and Theorem 8 all sets in Q are minimal separators.

ut

Remark. If we let T = ffbgg and Q = ; then a call separators(G; a; b; T ; Q) has the

same result.

Theorem 15. Let R(a; b) be the number of minimal a; b-separators (for non adjacent

vertices a and b). The algorithm to determine all minimal a; b-separators can be implemented to run in time O(n3 R(a; b)). Proof. Assume that the graph is given with an adjacency matrix. The minimal separator S that is close to b can easily be found in O(n2 ) time as follows. Initialize S = N(b). Determine the connected component Ca of G[V ? S]. Remove vertices from S that do not have a neighbor in Ca . Consider the time it takes to compute T 0 . For each S 2 T and for each x 2 S not adjacent to a we have to do the following computations. Determining  takes at most O(n2) time. Computing Ca0 and N can clearly be done in O(n2) time. Hence the time

7

procedure separators(G; a; b; T ; Q) input: Graph G and non adjacent vertices a and b and sets T and S of minimal a; b-separators. output: Set Q of all minimal a;b-separators in G. begin

end.

T 0 := ;;

for each S 2 T do begin Determine Ca ; f Ca is the connected component of G[V ? S ] that contains a.g for each x 2 S which is not adjacent to a do begin Determine ; f is the minimal x;a-separator in Ca (x) that is close to x.g Determine Ca0 ; f Ca0 is the connected component of G[Ca ? ] that contains a.g Determine N ; fN is the set of vertices in S that do not have a neighbor in Ca0 ,g S 0 := (S0 [ ) n N ; T := T [ fS g fAdd S  to T 0 only if not yet present!g end for end for; 0 Q := Q [ T ; separators(G; a;b; T 0 ; Q) Fig. 1. Algorithm listing minimal separators

to compute T 0 (which may contain elements which are already in Q) can be performed in O(n3j T j) time. We have to remove minimal separators from the new set T 0 which have been found before. We can do this by keeping Q in a suitable data structure, allowing an update in O(nj T 0 j logR(a; b)) = O(n2 j T 0 j) = O(n3 j T j) time. It follows that the computation of T 0 , containing only new minimal separators, can be performed in O(n3j T j) time. Since each newly computed set T 0 contains only minimal separators that have not been found before, it follows that the total time needed by the algorithm is O(n3R(a; b)). ut Corollary 16. The set of all minimal separators of a graph can be found in O(n5 R) time, where n is the number of vertices in the graph and R is the total number of minimal separators.

A somewhat di erent result is the following. Theorem 17. Assume G has at least R minimal separators. There exists an algorithm which nds R di erent minimal separators in O(n5 R) time. Proof. The claimed algorithm is simply the following. The algorithm listing minimal separators described above is stopped when R di erent ones have been found. It may 8

take time at most O(n5R), trying di erent pairs of nonadjacent vertices for which the total number of di erent minimal separators is smaller than R. Assume a pair of vertices has been found with enough new minimal separators. Now the analysis in the proof of Theorem 15 shows the claimed result. ut

6 Conclusions In this paper we have presented an algorithm to determine a list of all minimal vertex separators of a graph. The algorithm needs only polynomial time per separator that is found. We like to mention some open problems. First of all, we feel that it should be possible to improve the running time of the algorithm presented here. A related concept is that of an inclusion minimal separator . This is a minimal separator with the additional constraint that no proper subset is also a minimal separator. The following lemma shows that our algorithm can be used to nd all inclusion minimal separators. However, the example given in the introduction illustrates that this may not be an ecient way to do this. Lemma 18. A separator S of a graph G = (V; E) is inclusion minimal if and only if every vertex of S has a neighbor in every connected component of G[V ? S]. It follows that a list of all inclusion minimal separators can easily be obtained from the list of all minimal separators. Until now, we have not been able to nd an ecient algorithm which nds all inclusion minimal separators.

7 Acknowledgement We thank B. Monien (Paderborn) for drawing our attention to this important problem. We are grateful to an anonymous referee for his helpful comments.

References 1. Arnborg, S., Ecient algorithms for combinatorial problems on graphs with bounded decomposability { A survey, BIT 25 (1985), pp. 2{23. 2. Arnborg, S., J. Lagergren and D. Seese, Easy problems for tree-decomposable graphs, Journal of Algorithms 12 (1991), pp. 308{340. 3. Arnborg, S. and A. Proskurowski, Linear time algorithms for NP-hard problems restricted to partial k-trees, Discrete Applied Mathematics 23 (1989), pp. 305{314. 4. Bodlaender, H., A tourist guide through treewidth, Acta Cybernetica 11 (1993), pp. 1{21. 5. Bodlaender, H., A linear time algorithm for nding tree-decompositions of small treewidth, Proceedings of the 25th Annual ACM Symposium on Theory of Computing , (1993), pp. 226{234. 6. Bodlaender, H., T. Kloks and D. Kratsch, Treewidth and pathwidth of permutation graphs, Proceedings of the 20th International Colloquium on Automata, Languages and Programming , Springer-Verlag, Lecture Notes in Computer Science 700, (1993), pp. 114{ 125.

9

7. Bodlaender, H., T. Kloks, D. Kratsch and H. Muller, Treewidth and minimum ll-in on dtrapezoid graphs, Technical Report UU-CS-1995-34, Utrecht University, The Netherlands, (1995). 8. Gavril, F., Algorithms on clique separable graphs, Discrete Mathematics 19 (1977), pp. 159{165. 9. Goldberg, L. A., Ecient algorithms for listing combinatorial structures , Cambridge University Press, 1993. 10. Golumbic, M. C., Algorithmic Graph Theory and Perfect Graphs , Academic Press, New York, 1980. 11. Kanevsky, A., On the number of minimum size separating vertex sets in a graph and how to nd all of them, Proceedings of the First Annual ACM-SIAM Symposium on Discrete Algorithms , (1990), pp. 411{421. 12. Kloks, T., Treewidth | Computations and Approximations , Springer-Verlag, Lecture Notes in Computer Science 842, (1994). 13. Kloks, T., Treewidth of circle graphs, Proceedings of the 4th International Symposium, ISAAC'93, Springer-Verlag, Lecture Notes in Computer Science 762, (1993), pp. 108{117. 14. Kloks, T., Minimum ll-in for chordal bipatite graphs, Technical Report RUU-CS-93-11, Department of Computer Science, Utrecht University, The Netherlands, (1993). 15. Kloks, T. and D. Kratsch, Treewidth of chordal bipartite graphs, Journal of Algorithms 19 (1995), pp. 266{281. 16. Kloks, T., D. Kratsch and J. Spinrad, Treewidth and pathwidth of cocomparability graphs of bounded dimension, Computing Science Notes 93/46, Eindhoven University of Technology, The Netherlands, (1993). 17. Kratsch, D., The structure of graphs and the design of ecient algorithms, Habilitation (thesis), F.-Schiller-Universitat Jena, (1996). 18. Parra, A. and P. Scheer, How to use the minimal separators of a graph for its chordal triangulation, Proceedings of the 22rd International Colloquium on Automata, Languages and Programming , Springer-Verlag, Lecture Notes in Computer Science 944, (1995), pp. 123{134. 19. Tarjan, R. E., Decomposition by clique separators, Discrete Mathematics 55 (1985), pp. 221{232. 20. Whitesides, S. H., An Algorithm for nding clique cut-sets, Information Processing Letters 12 (1981), pp. 31{32.

This article was processed using the LATEX macro package with LLNCS style

10