Document not found! Please try again

Computing Minimum Cut Sets for Circular-Arc Graphs | a New Approach

0 downloads 0 Views 170KB Size Report
Feb 8, 1999 - Matthew J. Katz1 ... follows: Associate a node Ai with each arc ai 2 A, and draw an edge between ... P of points on the unit circle, such that, for each arc ai 2 A, ai \P 6= ;. Let c(A) be ... Daniels and Milenkovic [1] use piercing sets (which ... The endpoints that lie in the interior of a3 together with a3's two end-.
Computing Minimum Cut Sets for Circular-Arc Graphs | a New Approach 1

Matthew J. Katz

2

Frank Nielsen

1

Michael Segal

Department of Mathematics and Computer Science Ben-Gurion University of the Negev, Beer-Sheva 84105, Israel 1

Computer Science Laboratories Inc. 3-14-13 Higashi Gotanda, Shinagawa-Ku, Tokyo 141-0022, Japan 2

February 8, 1999

Abstract

Let A be a set of n arcs on the unit circle. We present a new simple 2(n logn)-time algorithm for computing a minimum cut set for A (and a maximum independent subset of A). Our solution is based on a dynamic maintenance scheme for a set S of n intervals on the line, that enables us to update the current minimum cut set for S , following an insertion or a deletion of an interval, in time O(c logn), where c is the size of the current minimum cut set.

1

Introduction Let A = fa = [l ; r ]; : : : ; an = [ln; rn]g be a set of n arcs on the unit circle, and consider the implicit circular-arc graph G (A) = (V (A); E (A)) de ned as follows: Associate a node Ai with each arc ai 2 A, and draw an edge between two nodes Ai and Aj if and only if ai \ aj = 6 ;. An independent subset of A is a set of pairwise non-intersecting arcs of A. Let b(A) be the size of a 1

1

1

1

maximum independent subset of A. That is, any independent subset of A is of size at most b(A), and there exists an independent subset of A of size b(A). (b(A) is also called the packing number of A.) A cut set for A is a set P of points on the unit circle, such that, for each arc ai 2 A, ai \P 6= ;. Let c(A) be the size of a minimum cut set for A. That is, any cut set for A is of size at least c(A), and there exists a cut set for A of size c(A). (c(A) is also called the piercing number or the transversal number of A.) For a set of intervals S on the line, it is easy to see that b(S ) piercing points (cuts) are also sucient in order to pierce (cut) all intervals in S (i.e., c(S ) = b(S )), and a minimum piercing set (i.e., a minimum cut set) can be found in this case in time O(n log b(S )) [7]. This is not true though for a set A of arcs on the unit circle. (Assume, for example, that A consists of three arcs, each of length 2=3, that together cover the circle, then b(A) = 1 while c(A) = 2.) However, it is easy to see (Claim 1) that in this case either c(A) = b(A) or c(A) = b(A) + 1. A point p on the unit circle induces a clique fai 2 Ajp 2 aig of the graph G (A). Notice that G (A) might also have cliques whose arcs do not share a point (see example above). Cliques of the former type are called linear cliques. Assume we wish to nd a minimum number of cliques of G (A) whose union is A. Hsu and Tsai [4] and Rao and Rangan [8] showed that if A itself is not a clique, then it suces to consider only linear cliques. Thus, if A is not a clique, the problem of nding a minimum piercing set for A is essentially equivalent to the problem of nding a minimum number of cliques of G (A) whose union is A. Golumbic and Hammer [2], Hsu and Tsai [4], Lee et al. [5], and Masuda and Nakajima [6] gave O(n log n)-time algorithms for computing a maximum independent set of a circular-arc graph with n arcs. (All these algorithms run in linear time if the endpoints of the arcs are already sorted). Gupta et al. [3] gave an (n log n) lower bound for this problem (actually, for the simpler problem of computing a maximum independent set of an interval graph with n intervals). Lee et al. [5] gave an O(n log n)-time algorithm for the minimum cut set problem together with an application to a facility location problem, and Hsu and Tsai [4] gave an O(n log n)-time algorithm for the minimum number of cliques problem. More recently, Tsai and Lee [10] investigated the problem of nding k best cuts (i.e., k cuts for which the number of di erent arcs that are cut is maximum). They showed how this problem is related to a 2

facility location problem. Daniels and Milenkovic [1] use piercing sets (which they call hitting sets) in connection with generating layouts for the clothing industry. In this paper, we reconsider the minimum piercing set problem for a set A of n arcs on the unit circle, that implicitly de ne a circular-arc graph as described above. We present an alternative O(n log n) solution to this problem which is quite simple. Our solution is di erent from its predecessors; it is based on a dynamic maintenance scheme for a set S of n intervals on the line, that enables us to update the current minimum piercing set for S , following an insertion or a deletion of an interval, in time O(c(S ) log n), where c(S ) is the size of the current minimum piercing set for S . Thus, if c(S ) is some constant, then we can compute a minimum piercing set for the new set in logarithmic time. Moreover, as long as c(S ) = o(n= log n), we can compute a minimum piercing set for the new set in sublinear time.

2

Minimum Piercing Set Let A = fa = [l ; r ]; : : : ; an = [ln; rn]g be a set of n arcs on the unit circle C centered at the origin. A set of points P  C is a piercing set for A, if for each a 2 A, we have a \ P = 6 ;. P is minimal, if for any other piercing set Q, we have jPj  jQj. Our goal is to compute a minimal piercing set for A. Let c denote the size of a minimal piercing set for A, and let b denote the size of a maximal independent subset of A, that is, a subset of A whose arcs are pairwise disjoint. Clearly c  b, since we need b piercing points in order to pierce all arcs in a maximal independent subset of A. For a set S of intervals on a line, b(S ) piercing points are also sucient in order to pierce all intervals in S , as is easily seen [7]. In our case, however, b piercing points may not be enough. For example, assume A consists of three arcs obtained 1

1

1

by cutting the circle C into three parts, then b = 1 while c = 2. It is easy to see though that the di erence between b and c can never exceed 1. Place a piercing point p anywhere on the circle C and remove all arcs that are pierced by p. We can think of the remaining arcs as intervals on a line. The size of a maximal independent subset of these intervals is either b or b 0 1. Thus, in view of the remark above concerning intervals on a line, either c = b + 1, or c = b. Therefore, we have: 3

Claim 1

points.

b

 c  b +1, and there exist sets of arcs that require b +1 piercing

For an arc a 2 A, let f (a) be the number of arc endpoints that lie in a, including a's two endpoints. Let a3 be an arc in A such that f (a3)  f (a) for any other arc a 2 A. Clearly f (a3)  b bn c, by the pigeon hole principle. 3 Claim 2 We can nd a in O (n log n) time. Indeed, we rst represent each of the endpoints p by its polar coordinates (r; ), and then sort the 2n endpoints by their polar angles and associate with each endpoint its rank. Now we can easily report in O(log n) time the number of endpoints that lie in any arc a. The endpoints that lie in the interior of a3 together with a3's two endpoints divide a3 into O(n=b) subarcs. Since a3 must be pierced, we traverse a3 from end to end moving from one subarc to an adjacent subarc. For each of these subarcs, we place in it a piercing point p, and compute a minimal piercing set for the remaining set of arcs that are not pierced by p (which can be viewed as a set of intervals on a line). The subarc for which the size of the corresponding minimal piercing set is the smallest is then chosen as the subarc in which p is eventually placed, and the nal piercing set is composed of p and the piercing set that was computed for this subarc. During the traversal, when moving from one subarc to an adjacent subarc we either enter or leave an arc of A. The main component of our solution consists of a sophisticated data structure for a set S of intervals on a line, that allows us to dynamically maintain a minimal piercing set for S , under insertions and deletions. Assuming that the number of intervals in S never exceeds n and that the size of the minimal piercing set never exceeds c(S ), we show that an insertion or deletion of an interval can be performed in time O(c(S ) log n). Since, in our case, the total number of updates is O(n=b) and by Claim 1 c  b + 1, we conclude that the total running time of our algorithm (for computing a minimal piercing for A) is O( nb c log n) = O(n log n). (Clearly, if there exists a point of C that is not covered by A, then we can simply treat the set A as a set of intervals on the line.) 2

2.1

The data structure

Let S be a set of m  n intervals on the line. We assume that from time to time a new interval is added to S or an existing interval is removed from S . 4

However, we require that at any moment S  n and the size of a minimal piercing set for S does not exceed c. We show how to maintain a minimal piercing set for S under insertions and deletions in O(c log n) time. We actually maintain a certain minimal piercing set which we call the right-to-left piercing set and which is de ned as follows. Find the rightmost left endpoint of an interval in S . This endpoint is the left endpoint of some interval s 2 S , and clearly the best location for a piercing point p in s is at its left endpoint. Remove all intervals that are pierced by p and reiterate. In this way we clearly obtain a minimal piercing set of S . The right-to-left piercing set can be computed easily in O(n log n) time. (Actually it can be computed in O(n log c(S )) time, see [7]). Initially, we compute the right-to-left piercing set P of S . We now construct a data structure of size O(n) that will allow us to update the right-to-left piercing set within the claimed bound. For each piercing point p 2 P , let Sp be the subset of intervals of S that were pierced by p during the right-to-left piercing process. These subsets are computed during the computation of P . Notice that an interval s 2 S is associated with the rightmost piercing point of P that pierces it. Construct a balanced binary search tree T on the piercing points in P . For each node v in T representing a piercing point p, construct a balanced binary search tree Tp on the right endpoints of the intervals in Sp, and let v point to the root of Tp. With each node w in Tp we store the point lw which is the rightmost among the left endpoints corresponding to the right endpoints in the subtree rooted at w. The over all construction time is O(n log n), and the resulting data structure is of size O(n). We now describe the algorithms for insertion and deletion of an interval. 2.2

Insertion

Let s = [sl; sr ] be a new segment to be added to S . We rst check, using the tree T , whether s is already pierced by the current piercing set P . If it is, then P is also the right-to-left piercing set of S [ fsg. We insert s into the tree Tp, where p is the rightmost point in P that lies in s, and update the values lw in all relevant nodes of Tp. All these operations can be done in O(log n) time. Assume now that s \P = ;. Notice that all the piercing points that lie to the right of s are also present in the right-to-left piercing set of S [ fsg and 5

their corresponding trees do not change. We rst insert sl as a new piercing point to the main tree T . Next we need to create its corresponding tree Tsl . Tsl should consist of the new segment s together with all segments in S that are pierced by sl, but not by any other piercing point to the right of sl . All these segments, however, must belong to Sp , where p is the rightmost piercing point to the left of sl. So we locate p in O(log n) time using T , and search in Tp in O(log n) time for the leftmost right endpoint e that lies to the right of sl. All the intervals in the right subtree of e together with e should be removed from Tp and added to Tsl . We must also update the values lw in the relevant nodes of both trees. Below we describe how to perform this transfer and update in a more general setting. It is possible that the interval de ning the point p has been transfered to Tsl . Let p0 be the value that is currently stored in the root of Tp. If p0 = p, then we are done, otherwise the interval de ning p has been transfered and we replace the piercing point p by p0. We now again need to locate the piercing point q that lies immediately to the left of p0, and transfer the intervals of Tq that are pierced by p0 to Tp . As before we search in Tq for the leftmost right endpoint e that lies to the right of p0. We need to move e and the intervals in its right subtree to Tp . In other words, ignoring e for the moment, we rst need to remove the right subtree of e from Tq , and then merge between this subtree and Tp . However, we observe that if s0 is an interval in the right subtree of e, then its right endpoint lies to the left of all right endpoints in Tp , since otherwise p 2 s0 and s0 should already be in Tp (which was obtained from Tp ). This property allows us to apply the standard split and join operations, see below, for removing the subtree and merging the two subtrees in O(log n) time. We then delete from Tq and insert into Tp the interval corresponding to e. We update the values lw in both trees (see Figure 1). We continue this way until we either reach a step in which the piercing point does not change, or we reach the leftmost piercing point of P . Clearly the whole insertion process takes only O(c log n) time. 0

0

0

0

0

0

2.3

Deletion

Let s = [sl; sr ] be an interval to be deleted from S . We locate the rightmost piercing point p of P that lies in s. We distinguish between two cases. If p 6= sl , then we remove s from Tp , update the necessary lw values and stop. 6

(a)

g1

g2

c1

a2 f1

a1 h2

h1

c2

f2

d1

e1

e2 d2

b2

b1

Tc1

(b)

c1

Tg1

g1

g2 (g1 )

e1

T

Te1

b2 (c1 ) a2 (a1 )

c2 (c1 )

e2 (e1 )

h2 (h1 )

d2 (d1 )

Tc1

(c)

Tg1

c1 e1

g1

g2 (g1 )

T

h2 (h1 )

e2 (e1 )

f1

c2 (f1 ) Tf1

a2 (a1 )

Te1

d2 (d1 )

f2 (f1 )

b2 (b1 )

Tf1

(d)

f1

Ta1

a1

g2 (a1 )

T

c2 (f1 ) b2 (b1 )

f2 (f1 )

e2 (e1 )

a2 (a1 )

h2 (h1 )

e1

Te1

d2 (d1 )

Figure 1: Inserting a new interval. (a) The initial interval set together with the new interval [f ; f ]; the initial piercing set is P = fe ; c ; g g. (b) The initial data structure. (c) [f ; f ] \ P = ; and therefore f is added to T and Tf1 is created. (d) c is replaced by a , the value at the root of Tc1 ; nally g is removed from T since Tg1 is empty; the new piercing set is fe ; f ; a g. 1

2

1

1

1

2

1

1

1

1

1

1

7

1

1

This can be done in O(log n) time. The more dicult case is when p = sl. In this case, we rst remove s from Tp. We then replace p (in T ) by the value p0 that is stored in the root of Tp , which now becomes Tp . We proceed as described in the insertion procedure, that is, we locate the piercing point q that lies immediately to the left of p0, and transfer the intervals of Tq that are pierced by p0 to Tp , and so on. The overall time spent on a deletion operation is thus O(c log n). The following two theorems summarize our results. 0

0

Theorem 3 Let S be a set of intervals on a line, and assume that the size of S never exceeds n. It is possible to construct, in time O(n log n), a data structure of size O(n), that enables us to maintain a minimum piercing set for S , under insertions and deletions of intervals to/from S , in time O(c log n) per update, where c is the size of the current minimum piercing set for S . Theorem 4 Let A be a set of n arcs on a circle. It is possible to compute a minimum piercing set for S in O(n log n) time.

2.4

Joining and splitting trees

We now describe how to implement the split and join operations that are used by the algorithms for insertion and deletion above. 2.4.1

Joining trees

Let A and A be two sets of keys, such that all the keys in A are smaller than i, and all the keys in A are greater than i, for some key i. Let TA1 and TA2 be the balanced binary search (red-black) trees for the sets A and A , respectively. The join operation join(A ; i; A ) described by Tarjan [9] takes TA1 , the key i, and TA2 , and returns the balanced binary search tree T A1 [fig[A2 for the set A [ fig [ A . In our case, i stands for the right endpoint e in the description of the algorithms for insertion and deletion. The general idea of Tarjan's join algorithm is to keep for each node an appropriate integer called rank with the following properties: 1. If x is any node with a parent, rank(x)  rank(p(x))  rank(x) + 1, where p(x) denotes the parent of x. 1

2

1

2

1

2

(

1

)

1

2

8

2

2. If x is any node with a grandparent, rank(x) < rank(p(p(x))). 3. If x is a leaf, then rank(x) = 0 and rank(p(x)) = 1 (if x has a parent). To perform join(A ; i; A ) we compare the rank r of the root of TA1 with the rank r of the root of TA2 . If r  r , we follow right pointers from the root of TA1 until we reach a node x with rank r . We replace x and its subtree by i, making x the left child and TA2 the right child of i. Then we rebalance the tree rooted at i using a standard rebalancing technique. The cost of Tarjan's join operation is O(log n). Moreover, within the same time bound we can update the values lw wherever needed. 1

2

1

1

2

2

2

2.4.2

Splitting trees

Let A be a set of keys, i some key that belongs to A, and TA a balanced binary search (red-black) tree for A. The split operation split(A; i) described in [9] takes TA and i and returns two balanced binary search trees: TA1 for all members of A that are smaller than i, and TA2 for all members of A that are greater than i. In our case, i stands for the right endpoint e in the description of the algorithms for insertion and deletion. In order to split a balanced binary search tree TA at an item i, one performs a sequence of the above join operations as follows. Initially, the current node x is the parent of i, the previous node y is i itself, the left subtree TA1 is set to be the left subtree of i, and the right subtree TA2 is set to be the right subtree of i. Next we repeat the following step until x becomes null: If y is the left child of x, then simultaneously replace x, y and TA2 by p(x), x and the result of joining TA2 , the right subtree of x and x; otherwise (y is the right child of x) simultaneously replace x ,y and TA1 by p(x), x, and the result of joining the left subtree of x, TA1 and x. The cost of Tarjan's split operation is O(log n). Moreover, within the same time bound we can update the values lw wherever needed.

References [1] K. Daniels and V. Milenkovic \Limited Gaps", in Proc. 6th Canad. Conf. Comput. Geom., pp. 225{231, 1994. 9

[2] M. C. Golumbic and P. L. Hammer \Stability in circular arc graphs", J. of Algorithms 9 (1988), pp. 314{320. [3] U. Gupta, D. T. Lee and Y.-T. Leung \Ecient algorithms for interval graphs and circular-arc graphs", Networks 12 (1982), pp. 459{467. [4] W.-L. Hsu and K.-H. Tsai \Linear time algorithms on circular-arc graphs", Information Processing Letters 40 (1991), pp. 123{129. [5] D. T. Lee, M. Sarrafzadeh and Y. F. Wu \Minimum cut for circular-arc graphs", SIAM J. Computing 19(6) (1990), pp. 1041{1050. [6] S. Masuda and K. Nakajima \An optimal algorithm for nding a maximum independent set of a circular-arc graph", SIAM Journal on Computing 17(1), pp. 41{52, 1988. [7] F. Nielsen \Fast stabbing of boxes in high dimensions", in Proc. 8th Canad. Conf. Comput. Geom., pp. 87{92, 1996, to appear in Theo. Comp. Sci.. [8] A. S. Rao and C. P. Rangan \Optimal parallel algorithms on circular-arc graphs", Information Processing Letters 33 (1989), pp. 147-156. [9] R. E. Tarjan \Data Structures and Network Algorithms", Regional Conference Series in Applied Mathematics 44, SIAM, 1983. [10] K. H. Tsai and D. T. Lee \k Best Cuts for Circular-Arc Graphs", Algorithmica 18(2) (1997), pp. 198{216.

10

Suggest Documents