and Cost-Optimal Algorithm for Interlocking Sets

0 downloads 0 Views 374KB Size Report
even if the endpoints are sorted, (logn) is a time lower bound for solving the problem in ... As an application of our algorithm for interlocking sets, we obtain a time- and cost-optimal ... jobs in such a way that the total number of processors is minimized. ... A parallel algorithm is termed time-optimal within a given computational ...
A Time- and Cost-Optimal Algorithm for Interlocking Sets, with Applications Stephan Olariu Albert Y. Zomaya Department of Computer Science Parallel Computing Research Lab Old Dominion University Dept. of Electrical and Electronic Eng. Norfolk, VA 23529-0162 Univ. of Western Australia, Perth, WA 6007 U.S.A Australia

Abstract Given a family I of intervals, two intervals in I interlock if they overlap but neither of them strictly contains the other. A set of intervals in which every two are related in the re exive transitive closure of the interlock relation is referred to as an interlocking set. The task of determining the maximal interlocking sets of I arises in numerous applications including trac control, robot arm manipulation, segmentation of range images, routing, automated surveillance systems, recognizing polygonal con gurations, and code generation for parallel machines. Our rst contribution is to show that any sequential algorithm that computes the maximal interlocking sets of a family of n intervals must take (n log n) time in the algebraic tree model. Next, we show that any parallel algorithm for this problem must take (log n) time in the CREW model even if an in nite number of processors and memory cells are available. We then go on to show that both the sequential and the parallel lower bounds are tight by providing matching algorithms running, respectively, in (n log n) sequential time and in (log n) time using n processors in the CREW model. At the same time, if the endpoints of the intervals are speci ed in sorted order, our sequential algorithm runs in (n) time, improving the best previously known result. It is interesting to note that even if the endpoints are sorted, (log n) is a time lower bound for solving the problem in the CREW model, regardless of the amount of resources available. As an application of our algorithm for interlocking sets, we obtain a time- and cost-optimal solution to a restricted version of the single row routing problem. The best previously known result for routing a set of n nets without street crossovers runs in O(log n log log n) time using n processors in the CRCW model. By contrast, our algorithm runs in (log n) time using logn n processors in the CREW model, being both time- and cost-optimal.

Keywords: circuit design, routing, CAD, VLSI, parallel algorithms, lower bounds, timeoptimal algorithms

 The rst author was supported, in part, by NSF grants CCR-9407180, CCR-9522093, and by

ONR grant N00014-95-1-0779; the second author was supported by ARC grant 04/15/412/131 and by Australian Telecommunications and Electronics Research Grant N045/268. Address for Correspondence: Prof. Stephan Olariu, Department of Computer Science, Old Dominion University, Norfolk, VA 23529-0162, U.S.A. email: [email protected]

1

1 Introduction A number of applications in scheduling, routing, circuit design, robotics, automated surveillance, and trac control are modeled by a family I = fIi = [ai ; bi ]jai  bi ; 1  i  ng of intervals. For example, in a class of scheduling problems [9, 11, 16], each interval Ii = [ai ; bi ] in the family I is interpreted as a job which has to be started at time ai and nished by time bi . A processor can be assigned to distinct jobs only if their corresponding intervals are non-overlapping. In this context, one is typically interested in an assignment of processors to jobs in such a way that the total number of processors is minimized. Computational tasks in trac control, robot arm manipulation, segmentation of range images, routing, automated surveillance systems, recognizing polygonal con gurations, and code generation for parallel machines [4, 10, 14, 17, 18, 20, 21, 24, 27] motivate one to say that two intervals in I interlock if they overlap but neither of them strictly contains the other. An interlocking set is a subset of I in which every two intervals are related in the re exive transitive closure of the interlock relation. In this context, one is interested in determining the maximal interlocking sets of I . Recently, Lloyd [15] showed that the problem of determining the maximal interlocking sets of a family of n intervals can be solved sequentially in O(n (n)) time if the endpoints of the intervals are available in sorted order, and in O(n log n) time otherwise. No parallel algorithm for this problem is known to the authors. It is worth noting that the algorithm of [15] cannot be readily parallelized. Yet another view of the family of intervals I is taken by abstracting the classic single row routing problem [26, 28, 29]. Here, one is given n points denoted by f1; 2; : : : ; ng on a horizontal line L, called the reference line, and a family of pairs of elements in f1; 2; : : : ; ng that have to be made electrically equivalent. The region above the line L is referred to as the upper street, while the region below it is called the lower street. For a pair fu; vg, (u < v), of points in L that have to be made electrically equivalent, the connection consists of a vertical segment joining u to one of the horizontal tracks in the upper or lower street, followed by a horizontal portion along the track, followed by a vertical segment connecting the track with point v. In the presence of a set of constrains, the feasibility problem is to determine whether a routing satisfying all the given constraints is possible. The realization problem is to obtain the prescribed set of connections (i.e. routing) while satisfying the given constraints. Since the problem of producing an optimal routing for a number of popular objective functions is NP-hard [20, 22, 23], one is typically interested in solving a particular instance of the problem which is both tractable and robust enough to be applicable to various situations. Several authors have proposed ecient algorithms for solving restricted instances of the general single row routing problem. For example, Raghavan and Sahni [22] have addressed the problem of routing a set of nets in the particular case where no street crossovers are permitted. In [22] given a set of n nets to be routed, the feasibility and the realization problems are solved in O(n2 ) time. Later, Saxena and Prasad [25] have reduced the complexity to O(n) which is optimal. Their sequential algorithm is graph-theoretical, relying on computing connected components, spanning trees, and graph coloring. Saxena and Prasad [25] then go on to parallelize their sequential algorithm. Due to the bottleneck of computing connected

components and spanning trees, the resulting parallel implementation runs in O(log n log log n) time using n processors in the CRCW model of computation. In the light of the O(n) sequential algorithm, the parallel algorithm of [25] is, clearly, not cost-optimal. In this paper we assume the Parallel Random Access Machine model which consists of synchronous processors, each having access to a common memory. In each step, the processors perform the same instruction, with a number of processors masked out. In the Exclusive Read Exclusive Write PRAM model (EREW, for short), exclusive access is used for both reading and writing. In the Concurrent Read Exclusive Write PRAM model (CREW, for short), several processors may simultaneously read the same memory location, but exclusive access is enforced for writing. In the Concurrent Read Concurrent Write PRAM model (CRCW, for short), several processors may simultaneously access the same memory location, both in reading and writing. The interested reader is referred to [2, 12] for an excellent presentation of the PRAM model. The cost of a parallel algorithm is taken to be the product of its running time and the number of processors used. If the cost of a parallel algorithm matches the sequential lower bound for the given problem, the parallel algorithm is termed cost-optimal. A parallel algorithm is termed time-optimal within a given computational model if no other parallel algorithm solving the same problem runs faster in that model. The main contribution of this paper is to provide a unifying approach to solving both the problem of determining the maximal interlocking sets of a family of intervals and the problem of routing a set of nets without street crossovers. Our general approach yields time- and costoptimal algorithms for these problems. We begin by showing that the task of determining the maximal interlocking sets of a family of n intervals has a lower bound of (n log n) in the algebraic computation tree model. This result shows that the algorithm of Lloyd [15] is optimal (Lloyd did neither claim nor prove the optimality of his algorithm). Next, we show that any parallel algorithm that solves an instance of size n of the maximal interlocking set problem or of the constrained single row routing problem must take (log n) time in the CREW model, even if an in nite number of processors and memory cells are available. Further, we show that these lower bounds are tight by providing matching algorithms. Speci cally, we devise a very simple parallel algorithm for determining the maximal interlocking sets of a family of n intervals, running in (log n) time and using n processors in the CREW model. In case the endpoints of the intervals are sorted, our algorithm runs in (log n) time and uses logn n processors in the CREW model. This latter result implies an optimal sequential algorithm for the problem running in (n) time if the endpoints are sorted, thus showing that the (n) factor in Lloyd's algorithm is not essential. Our next algorithm solves the task of deciding whether a collection of n nets can be routed without street crossovers in (log n) time using logn n processors in the CREW-PRAM, thus being both time- and cost-optimal. In addition, if the routing of the collection of nets is possible such a routing is also returned. The remainder of this work is organized as follows: Section 2 formally de nes the problems we solve and presents our lower bound arguments. Section 3 discusses basic algorithmic techniques which are useful in subsequent sections of this work. Section 4 introduces the tools that are crucial in obtaining our time- and cost-optimal algorithms. Section 5 discusses the

details of our time-optimal algorithm to determine the maximal interlocking sets. Section 6 discusses the details of the proposed time-optimal algorithm for the problem of deciding whether a collection of nets can be routed without street crossovers. Finally, Section 7 o ers concluding remarks.

2 Problem statement and lower bounds The purpose of this section is to state formally the problems we solve and to provide lower bounds that establish the time- and cost-optimality of our algorithms for these two problems. We begin by stating the rst problem that we address in this paper. Given a family

I = fIi = [ai; bi ] j ai  bi ; 1  i  ng of intervals, we say that intervals Ii and Ij interlock whenever

ai < aj < bi < bj or aj < ai < bj < bi : As an illustration, intervals I1 and I5 in Figure 1 interlock. It is clear that the interlock relation R is symmetric. In many applications in VLSI design, trac control, automated surveillance, and robotics [15, 25] one is interested in the re exive, transitive closure R of R. Speci cally, for every pair of intervals Ii ; Ij in I , we write Ii R Ij whenever there exists a sequence Ii = Iu ; Iu ; : : : ; Iut = Ij of intervals in I such that 0

1

for every k; (0  k  t ? 1); intervals Iuk and Iuk interlock: +1

I6 I5

s

I2

s

I3

s

I1

s

(0)

s

s

s

s

s

s

I4

s

s

Figure 1: A family of intervals It is easy to see that the relation R de ned by (0) above is an equivalence relation on I . The corresponding equivalence classes are precisely the maximal interlocking sets of I . As an illustration, in Figure 1, the corresponding equivalence classes are fI1 ; I2 ; I5 g and fI3 ; I4 ; I6 g. The rst problem that we address in this paper is the INTERLOCK problem stated as follows.

INTERLOCK: Given a family I = fIi = [ai; bi ] j ai  bi; 1  i  ng of intervals, nd all the maximal interlocking sets of I . An easy way of visualizing the maximal interlocking sets of I is to associate with family I a graph G(I ) de ned as follows:  the vertices of G(I ) are the intervals in I ;

I2 ?@

I4 ?@

s

? @@ ? I I

s

1

s

s

5

? @@ ? I I 6

s

s

3

Figure 2: The interlock graph of the family of intervals in Figure 1

 two vertices are joined by an edge if and only if the corresponding intervals interlock. In this representation, the maximal interlocking sets of I are precisely the connected components of G(I ). In [15], the graph G(I ) is termed the interlock graph of I . Constructing the interlock graph in the straightforward way takes O(n2 ) time and is, therefore, algorithmically somewhat unsatisfactory. Figure 2 shows the interlock graph of the family of intervals featured in Figure 1.

2.1 Lower bounds for the INTERLOCK problem To establish a sequential lower bound for the INTERLOCK problem we rely, in part, on the fact that the following problem has a lower bound of (n log n) in the algebraic tree model of computation. We refer the reader to [19] p. 260 for details and derivations.

UNIFORM GAP: Given a sequence of n real numbers x ; x ; : : : ; xn, along with a positive 1

2

, determine whether the di erence between consecutive numbers is uniformly equal to . (Two numbers xi and xj are said to be consecutive if they are such in the sorted order of the given sequence.)

Proposition 2.1. [19] UNIFORM GAP has a lower bound of (n log n) in the algebraic tree model of computation.

Theorem 2.2. INTERLOCK has a lower bound of (n log n) in the algebraic tree model of computation.

Proof. We shall reduce UNIFORM GAP to INTERLOCK. For this purpose, assume that the

input to UNIFORM GAP is a sequence x1 ; x2 ; : : : ; xn of real numbers along with a positive . Given this input, we begin by constructing a family I of intervals I1 ; I2 ; : : : ; In by associating with each number xi the interval Ii = [xi ; xi + ]. Observe that if Ii and Ij interlock, then jxi ? xj j <  and, consequently, the answer to UNIFORM GAP must be \no". With this observation in mind, let C1 ; C2 ; : : : ; Cp be the maximal interlocking sets obtained by solving the corresponding instance of the INTERLOCK problem. As noted, if p < n the answer to UNIFORM GAP is \no". On the other hand, if p = n, then for every i; j , the intervals Ii = [xi ; xi + ] and Ij = [xj ; xj + ] either coincide, or are disjoint.

To handle the rst case above, we construct a second instance of the INTERLOCK problem by associating with each number xi the intervals I 0 i = [xi ; xi + =2] and I 00 i = [xi + =3; xi + ]. It is easy to con rm that our construction is such that the intervals I 0i ; I 00 i ; I 0 j ; I 00j corresponding to equalS numbers xSi = xj belong to the same maximal interlocking set of the set of intervals J = ( nk=1 I 0 k ) [ ( nk=1 I 00 k ). Let D1 ; D2 ; : : : ; Dq be the maximal interlocking sets obtained by solving the corresponding instance of the INTERLOCK problem. Clearly, if q < n then the answer to UNIFORM GAP is \no". Finally, if q = n then we know that none of the numbers x1 ; x2 ; : : : ; xn coincide and, by virtue of the fact that p = n, that they are spaced at least one  apart. To verify whether the answer to UNIFORM GAP is \yes" we compute xmin = min1in xi , and xmax = max1in xi as well as the average gap = xmaxn??1xmin . If = , then the answer to UNIFORM GAP is \yes", otherwise the answer is \no". We have just proved that UNIFORM GAP is linearly reducible to INTERLOCK. Now the conclusion follows from Proposition 2.1. Our next goal is to establish a time lower bound for the task of solving the INTERLOCK problem in the CREW model. For this purpose, we rely on a fundamental result of Cook et al. [7]. To make this paper self-contained, we de ne the OR problem and state the relevant result from [7].

OR: Given n bits b ; b ; : : : ; bn, compute their logical OR. Proposition 2.3. [7] OR has a time lower bound of (log n) in the CREW model, regardless 1

2

of the number of processors and memory cells available.

6

7

r

6

r

5

r

4

r

3

r

2

r

1

r

0

r

I1

r

I2

r

r

I3

r

r

I4

r

r

I5 r

1

r

2

r

3

r

4

r

5

r

6

r

7

r

r

8

r

r

9

r

10

r

11

Figure 3: Illustrating the time lower bound for the INTERLOCK problem

-

Lemma 2.4. The problem of determining the maximal interlocking sets of a collection of

n intervals with integer endpoints has a time lower bound of (log n) in the CREW model,

regardless of the number of processors and memory cells available. Proof. We shall reduce OR to INTERLOCK. For this purpose, let b1 ; b2 ; : : : ; bn be an arbitrary input to the OR problem. Given this input, we construct a family I = fI1 ; I2 ; : : : ; In g of intervals with integer endpoints by setting for all i, (1  i  n), Ii =[ai ; bi ] such that ai = (2(i ? 1); n + 1 ? i) and:

(

i + 1; n + 1 ? i) if bi = 0 bi = (2 (2i ? 1; n + 1 ? i) if bi = 1.

(1)

Figure 3 illustrates this construction for the input sequence b1 = 0, b2 = 0, b3 = 1, b4 = 1, b5 = 0. It is important to note that our construction speci ed by (1) guarantees that the answer to the OR problem is 0 if and only if there exists a single maximal interlocking set. Therefore, once the answer to the INTERLOCK problem is available, one can nd the answer to OR in O(1) time. Since the reduction can be performed in parallel in O(1) time, by virtue of Proposition 2.3, any algorithm that solves the INTERLOCK problem must take (log n) time in the worst case. This completes the proof of the lemma. Lemma 2.4 has the following important consequence.

Theorem 2.5. Any algorithm that solves an arbitrary instance of size n of the INTERLOCK problem must take (log n) time in the CREW model, regardless of the number of processors and memory cells available.

2.2 A time-lower bound for the CROSSOVER problem In order to be in a position to formally state the second problem that we address in this paper, a little background information is necessary. Recall that in the single row routing problem we are given a set V = f1; 2; 3; : : : ; ng of nodes evenly spaced along a straight line, called the reference line, along with a collection N = fN1 ; N2 ; : : : ; Nm g of nets describing the connection pattern amongst the nodes in V . The space above the reference line, consisting of a number of horizontal tracks is referred to as the upper street, while the space below the reference line is known as the lower street. The collection of nets satis es the following conditions:  each element of V belongs to exactly one net;  each net involves exactly two elements of V . The problem is to make the nodes belonging to the same net electrically equivalent by connecting them with wire in such a way that every net is wholly routed within one street, i.e. without street crossovers. The second problem that we address in this paper is stated formally as follows:

CROSSOVER: Given a collection N of n nets N ; N ; : : : ; Nn , decide whether they can be routed without street crossovers.

1

2

Theorem 2.6. The problem of deciding whether a collection of n nets can be routed without

street crossovers has a time lower bound of (log n) in the CREW model, regardless of the number of processors and memory cells available. Proof. We shall reduce OR to CROSSOVER. For this purpose, let b1; b2 ; : : : ; bn be an arbitrary input to the OR problem. We construct an instance N1 ; N2 ; : : : ; N3n of the CROSSOVER problem by associating with every bit bi , (1  i  n), the nets N3(i?1)+1 ; N3(i?1)+2 ; N3i de ned as follows: 1. if bi = 0 then

2. if bi = 1 then

N3(i?1)+1 =[3(i ? 1) + 1; 3(2n ? i + 1)], N3(i?1)+2 =[3(i ? 1) + 2; 3(2n ? i) + 2], and N3i =[3i; 3(2n ? i) + 1]. N3(i?1)+1 =[3(i ? 1) + 1; 3(2n ? i) + 1], N3(i?1)+2 =[3(i ? 1) + 2; 3(2n ? i) + 2], and N3i =[3i; 3(2n ? i + 1)].

We refer the reader to Figure 4(a) and (b), respectively, for an illustration of these nets in the case bi = 0 and the case bi = 1. Our construction guarantees that the nets corresponding to a bit bi = 1 cannot be routed without street crossovers. Therefore, any algorithm that correctly solves the CROSSOVER problem provides, at the same time, an answer to the OR problem. Since the reduction can be performed in parallel in O(1) time, the conclusion follows from Proposition 2.3.

t

t

t

i ? 1)+1 3(i ? 1)+2 3i

3(

t

t

t

i ? 1)+13(i ? 1)+2 3i

3(

. . .

(a)

. . .

t t

t

n ? i)+1 3(2n ? i)+2 3(2n ? i + 1)

3(2

t t t

n ? i)+1 3(2n ? i)+2 3(2n ? i + 1)

3(2

(b)

Figure 4: Illustrating the nets in case bi = 0 and bi = 1

3 Basic tools for upper bounds Consider a sequence a1 ; a2 ; : : : ; an of elements from a semigroup endowed with an associative operation . The pre x computation problem is to determine all the pre x 's a1 , a1  a2 ,

: : : ; a1  a2    an . The pre x computation problem turned out to be one of the fundamental

techniques of parallel processing, with applications to numerous algorithms [12, 27]. In many contexts, one is interested in pre x sums (i.e. operation  is addition), or in pre x maxima, etc. Cole and Vishkin [6] have shown that the pre x computation problem can be solved optimally in parallel. Their algorithm runs in O(log n) time using logn n processors in the EREW model. The problem of list ranking is to determine in parallel the rank of every element in a given linked list, that is, the number of elements following it in the list. The weighted list ranking problem is similar: here, every element of a linked list has a weight, and the problem is to compute, for every element of the list, the sum of the weights of the elements following it in the list. List ranking has turned out to be one of the fundamental techniques of parallel processing, playing a crucial role in a vast array of important parallel algorithms [12]. Cole and Vishkin [6] and Anderson and Miller [3] showed that list ranking can be performed optimally in O(log n) time using O( logn n ) processors in the EREW model. The All Nearest Larger Values problem (ANLV, for short) is de ned as follows: given a sequence a1 ; a2 ; : : : ; an of values from a totally ordered universe, determine for each element ai the nearest element to its left and the nearest element to its right that are larger than it. More formally, for every i, (1  i  n), nd the largest j , (1  j < i), and the smallest k, (i < k  n), for which aj > ai and ak > ai . In this context, aj and ak are termed, respectively, the left mate and the right mate of ai . To visualize the ANLV problem, assume that all elements a1 ; a2 ; : : : ; an are positive. One can replace each element ai by a vertical line segment Li whose endpoints are (i; 0) and (i; ai ). Now, imagine shooting horizontal rays from the top endpoint of each segment Li in the positive and negative x-direction, as illustrated in Figure 5. It is easy to con rm that the left mate of ai is aj if and only if the horizontal ray in the negative x-direction emanating from the top endpoint of Li meets Lj before meeting any other segment. Similarly, ak is the right mate of ai if and only if the horizontal ray in the positive x-direction from the top endpoint of Li meets Lk before meeting any other segment. Kim [13] has shown that the ANLV problem can be solved cost-optimally in the EREW model. For later reference, we state the following result [13].

Proposition 3.1. An arbitrary instance of size n of the ANLV problem can be solved in O(log n) time using logn n processors in the EREW model.

Sorting is unquestionably one of the fundamental problem in computer science. It is not surprising, therefore, that the sorting problem has received a lot of attention both sequentially and in parallel. Ajtaj, Komlos and Szemeredi [1] were the rst to construct a boundeddegree sorting network of O(log n) depth that was able to sort n number with O(n log n) cost. However, the constant hidden in the big-O notation was quite large. Later, Cole [5] proposed a sorting algorithm that takes O(log n) time and uses O(n) processors in the EREW model of computation.

(6

)

 ..................................................................................................................................................................... .6 ;a

(1

)

 .......................................................................................... ; a1

 ............................................(4 ....;.................................. .a4 )

(2

)

 ................................................ . ; a2

3)  ...........(3...................... ;a

(2,0)

(1,0)

(5

 ...........(7....;.................................. .a7 ) -...........(10 ......;.a10-)

........

)

 ............................... .5 ;a

(4,0)

(3,0)

 ...........................................(9 ....;........................... .a9 )

(5,0)

(8

)

 ................................ .8 ;a

(7,0)

(6,0)

.

(9,0)

(8,0)

(10,0)

Figure 5: Visualizing the ANLV problem

4 A closer look at the INTERLOCK problem The purpose of this section is to develop the tools that will be key ingredients in our subsequent time- and cost-optimal algorithms for the INTERLOCK and CROSSOVER problems. Throughout this section we assume a family I = fIi = [ai ; bi ] j ai  bi ; 1  i  ng of interI7 8 10

I4

4

13

I6

7

12

I1

1

I5

6

11

I8

14

I3

3 2

9

17

I2

16 15

5

I9

18

Figure 6: A family I of intervals vals. To avoid handling inconsequential boundary conditions we assume that all endpoints of intervals in I are distinct. One simple way around degeneracy is to consider the intervals as open sets, that do not contain their endpoints. Yet another way of coping with the problem was pointed out in [15]. We begin by associating with the family I a new family of intervals A(I ) = fA1 ; A2 ; : : : ; An g as follows. Having enumerated the intervals in I in sorted order of their left endpoints as Ii ; Ii ; : : : ; Iin , we associate with every interval Iij = [aij ; bij ] the interval Aj with left and right endpoints of coordinates (aij ; j ) and (bij ; j ), respectively. It is worth noting that the 1

2

family A(I ) of intervals is just I , speci ed in sorted order of left endpoints and \elevated" to two-dimensions. As a consequence, two intervals Iij and Iik interlock in I if and only if the corresponding intervals Aj and Ak interlock in A(I ). Figure 7 shows the family A(I ) corresponding to the family I of intervals I1 =[1,17], I2 =[2,5], I3 =[3,16], I4 =[4,13], I5 =[6,9], I6 =[7,12], I7 =[8,10], I8 =[11,14], I9 =[15,18] in Figure 6. .. .6 A = I 9 9 . . . . (18,9) (15,9)

.. (11,8) ..6 (10,7)

(4,4)

(8,7) A7 = I7 A6 = I 6 (7,6) ..6 .. A 5 = I5 (6,5) (9,5) A4 = I4 A3 = I 3 .

.

(3,3) (1,1)

..6 . (5,2)

A2 = I 2

(2,2)

A. 8 = I.8 ..6 .. .. .

..6 .. (14,8)

..6 .. .. .. (12,6) ... .. .. (13,4)

A1 = I1

..6 .6 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . (16,3) ... .. .. .. (17,1)

Figure 7: Illustrating the construction of A(I ) and F (I ) Once the family A(I ) is available, we construct a forest F (I ) as follows:  the nodes of F (I ) are the intervals in I ;  the parent of interval Iij is the interval Iik if the vertical ray emanating from the right endpoint of Aj and going in the positive y-direction meets Ak before meeting any other interval in A(I ); otherwise, the parent of Iij is nil. We refer the reader to Figures 7 and 8 illustrating the construction of the forest F (I ) corresponding to the family I in Figure 6.

 .  o 7 S   S   6  

I1

I3

I2

 .  o S 7    S   6   I8

I9

I4

I7

 

I6

I5

Figure 8: Illustrating the forest F (I ) In a similar fashion, we associate with the family I a second family of intervals B(I ) = fB1 ; B2 ; : : : ; Bn g as follows. Enumerate the intervals in I in sorted order of their right endpoints as Ij ; Ij ; : : : ; Ijn . With every interval Ijk = [ajk ; bjk ] in I we associate the interval 1

2

Bk with left and right endpoints of coordinates (ajk ; k) and (bjk ; k), respectively. The reader

should have no diculty verifying that the new family B(I ) is essentially the family I speci ed in sorted order of right endpoints and \elevated" to two-dimensions; as a consequence, two intervals of I interlock if and only if the corresponding intervals in B(I ) interlock. Figure 9 shows the family B(I ) corresponding to the family I of intervals in Figure 6. (18,9) (15,9) ... B = I 9 9 . (1,8) ...

B8 = I 1 .. .. .. .. (3,7) . .. .. B7 = I 3 .. .. .. .. .. .. .. .. (11,6) .. B = I .. .. .. 6 8 (14,6) .. .. .. .. (4,5) .. .. . .. . .. ? (13,5) .. .. .. B = I 5 4 .. .. .. .. .. .. .. .. .. .. .. .. (7,4) ... (12,4) .. .. B4 = I6 .. . . . .. .. .. .. .. .. . . . .. . .. .. . .. . .. .. (8,3) . .. .. .. .. B3 = I7 (10,3) .. .. .. .. .. . .. .. .. .. .? ..? (9,2) .. .. (6,2) .. .. . .. .. .. B2 = I5 .. .. .. . .. .. (2,1) .. .. (5,1) ... ? ? .. .. .. .. .. .. B1 = I2 .. .. .. .? ??

.. .. .. .

?

(17,8) (16,7)

Figure 9: Illustrating the construction of B(I ) and F 0 (I ) Having obtained B(I ), we construct a forest F 0 (I ) as follows:  the nodes of F 0 (I ) are the intervals in I ;  the parent of interval Ijk is the interval Ijl if the vertical ray emanating from the left endpoint of Bk and going in the negative y-direction meets Bl before meeting any other interval in B(I ); otherwise, the parent of Ijk is nil. We refer the reader to Figures 9 and 10 illustrating the construction of the forest F 0 (I ) corresponding to the family I in Figure 6. As we are about to demonstrate, the two forests F (I ) and F 0(I ) carry enough information to allow the construction of the maximal interlocking sets of I . For this purpose, we now take note of a number of technical properties of F (I ) and F 0 (I ). We begin by observing that, by construction, every interval in I belongs to exactly one tree of F (I ) and to one tree of F 0 (I ).

  . .   7 o 7 S    S  .    6   I1

I9

I3

I4

 .  o 7   S  S   I5

I2

I6

I7

I8

Figure 10: Illustrating the forest F 0 (I ) Our rst result shows that the individual trees in F (I ) and F 0 (I ) capture the essence of the interlock relation.

Lemma 4.1. Any two interlocking intervals of I belong to the same tree of F (I ) or to the same tree of F 0 (I ). Proof. Suppose the statement is false for some xed I . From the set of counterexamples we select an interval Ip = [ap ; bp ] with

ap as small as possible

(2)

and such that Ip and some interval Iq = [aq ; bq ] interlock, yet they belong to distinct trees in both F (I ) and F 0 (I ). Our choice of Ip and Iq speci ed above implies that

ap < aq < bp < bq :

(3)

Now, equation (3) guarantees that Ip is not the root of a tree in F (I ) and that Iq is not the root of a tree in F 0 (I ). Let T be the tree of F (I ) to which Ip belongs. Similarly, let T 0 be the tree of F 0 (I ) that contains Iq . We assume that the root of T is the interval Iu = [au ; bu ]. Equation (3), together with the fact that Iq does not belong to T implies that bq < bu . Recall that Ip and Iu are distinct intervals, and consider the unique path in T joining Ip and Iu . Consider, further, the last interval Is = [as ; bs ] on this path in the direction from Ip to Iu for which ap < as < a q : (4) (Recall that Ip and Iq are not in the same tree of F (I ). We note that the existence of Is is implied by equation (3).) Our choice of Is along with the fact that Is is in T and Iq is not, guarantees that

bq < bs :

(5)

In other words, (3), (4), and (5) imply that

a p < a s < a q < b p < b q < bs :

(6)

A mirror argument proves the existence of an interval It = [at ; bt ] in T 0 such that

at < ap < aq < bp < bt < bq :

(7)

Observe that (6) and (7), combined, yield

at < as < b t < b s

(8)

implying that the intervals It and Is interlock. Moreover, just like Ip and Iq , the intervals It and Is belong to di erent trees in both F (I ) and F 0 (I ). However, in this case, we should have chosen It instead of Ip , contradicting (2).

Lemma 4.2. All the intervals that belong to the same tree of F (I ) (resp. F 0(I )) are in the same maximal interlocking set of I . Proof. We prove the statement for F (I ), the proof for F 0 (I ) following the same pattern. Let Iu and Iv be arbitrary intervals belonging to some tree T of F (I ) rooted at Iw . The construction of F (I ) guarantees that each node in T interlocks with its parent node. It

follows that, with R standing for the re exive transitive closure of the interlock relation, we have Iu R Iw and also that Iv R Iw . Since R is an equivalence relation, we have Iu R Iv , and the conclusion follows.

Lemmas 4.1 and 4.2 tell us that the individual trees of F (I ) and F 0 (I ) contain partial information about the maximal interlocking sets of I . The problem is to combine the information in various trees of F (I ) and F 0 (I ). Our next result provides the rst step in this direction.

Lemma 4.3. Every root of a tree of F 0 (I ) (resp. F (I )) is a leaf in some tree of F (I ) (resp. F 0 (I )). Proof. We prove the statement for F 0 (I ), the proof for F (I ) being similar. Let Iw =[aw ; bw ] be the root of some tree of F 0 (I ) and let T be the tree of F (I ) to which Iw belongs. If Iw

is not a leaf in T , then it must be the parent of some node Iv =[av ; bv ] belonging to T . This, however, implies that av < aw < bv < bw : (9) But now we have reached a contradiction: (9) guarantees that the vertical ray in the negative y-direction emanating from aw must intersect some interval, possibly Iv , implying that Iw cannot be the root of a tree in F 0 (I ). This completes the proof of Lemma 4.3. An interval in I is said to be special if it is the root of a tree in F 0 (I ) and a leaf in some tree in F (I ). In fact, Lemma 4.3 tells us that every interval corresponding to a root in F 0 (I ) must L be special. In addition, Lemmas 4.1|4.3 motivate us to de ne the operation of glueing the forest F 0 (I ) onto F (I ). Formally, the resulting forest

P (I ) = F (I ) L F 0 (I ) is obtained by replacing every special leaf Iu in F (I ) by the tree of F 0 (I ) rooted at Iu . For an illustration of glueing, the reader is referred to Figures 11 and 12. Figure 11 shows the tree

{

u

I

B  B B  B  B  B   B I

w

{

I

{

w

!

B  B B  B  B  B  B 

v

{

I

{

u

B  B B  B  B  B I  w B B B  B  B  B  B   B

{

I

v

{

I

Figure 11: Illustrating replacing leaf Iw by the tree of F 0 (I ) rooted at Iw of F 0 (I ) rooted at Iw and the tree of F (I ) rooted at Iu , containing Iw as a leaf. As part of the glueing of F 0 (I ) onto F (I ), the leaf Iw will be replaced by the tree of F 0 (I ) having Iw as a root. Further, Figure 12 illustrates the result of glueing for the family of intervals in Figure 6. For the reader's convenience, the trees of F 0 (I ) are drawn in dotted edges and their roots are highlighted.

    .  .  o S o S 7  7    S  S ~    .. 6 6 ..7  ~  . . ~.. . ... . . ]... . o.. .7   . ..7  .     .. ..6 ..   I3

I1

I9

I6

I4

I5

I2

I3

I7

I8

I9

I4

I6

I7

I8

L

Figure 12: Illustrating the forest P (I ) = F (I ) F 0 (I ) Let < be the set of roots of trees in P (I ). We de ne a binary relation  on < by writing for every Iu ; Iv in

Suggest Documents