Parallel Computing 17 (1991) 241-252 North-Holland
241
Parallel V o r o n o i d i a g r a m in L a metric o n a m e s h - c o n n e c t e d c o m p u t e r * Chang-Sung Jeong Department of Computer Science, Pohang Institute of Science and TechnoloKv, P.O. BOX 125, Pohang Kyungbuk 680, Korea
Received 10 July 1990
Abstract
Jeong, C.S., Parallel Voronoi diagram in L1 (L~) metric on a mesh-connectedcomputer, Parallel Computing 17 (1991) 241-252 In this paper, we consider the problem of constructing a Voronoi diagram in L~(L.o ) metric for a set of n points in the Cartesian plane on a mesh-connected computer. An o(vrn) parallel algorithm on a v~xvtn mesh-connected computer is given for solving that problem. This is the first solution on a Vr~x Vt~ MCC to achieve an asymptoticallyoptimal 0(vrn) running time for Ll(Loo ) metric. Keywords. Parallel algorithm; Voronoi diagram; mesh-connected computer.
1. Introduction A mesh connected computer (MCC) is an S I M D (single instruction stream, multiple data stream) computer where the processing elements (PE's) are synchronized and operate under the control of a single instruction stream by a control unit. An MCC consists of n identical PE's arranged on a ~ x v~- array, where each PE has a constant number of storage registers. In an MCC, each PE can communicate with its four neighbors and perform standard arithmetic or boolean operation in O(1) time. In this paper, we consider the problem of constructing a Voronoi diagram on the MCC. The Voronoi diagram is a well known geometric construct used in the solution of numerous problems in computational geometry. The Voronoi diagram for a set S of n planar points is a partition of the plane into n regions each of which is associated with a point and closer to that point than to any other point in S. Shamos and Hoey [1] first described an O(n log n) sequential algorithm for constructing the Voronoi diagram for n planar points and showed that it can be used as a powerful tool to give efficient algorithms for a wide variety of geometric problems. The Voronoi diagrams for other metrics have been studied by several researchers. Hwang provided an O(n log n) algorithm for the L 1 metric to solve the rectilinear minimal spanning tree problem [2], and Lee and Wong gave an O(n log n) algorithm for the L t and Loo metrics as an application to the problem of minimizing read/write head movement [3]. Lee presented an O(n log n) algolithm for the general Lp metric [4]. * Research supported in part by KOSEF grant. 0167-8191/91/$03.50 © 1991 - Elsevier Science Publishers B.V. (North-Holland)
242
C.S. Jeong
Recently, parallel algorithms have been considered for Voronoi diagrams on various parallel models. Chow showed that Voronoi diagram can be computed in O(log4n) time on cube connected cycles [5], and Lu obtained an O(v~-log n) algorithm on a ~ - x ~fn MCC [6]. They used Brown's idea that Voronoi diagram in 2-dimensions can be computed from the convex hull of the same point set in 3 dimensions [7]. By using the divide-and-conquer technique, Aggarwal et al. showed that Voronoi diagram can be directly computed in O(log 3 n) time on CREW (concurrent read and exclusive write) shared memory model [8]. Jeong and Lee presented an O(¢n-) parallel algorithm for constructing Voronoi diagram on a ~ x ¢~- MCC [9,10]. All of them considered the Voronoi diagram only in L 2 metric. In this paper, we shall consider the problem of constructing the Voronoi diagram in L1 and L~ metrics for a set of n points in the Cartesian plane on an MCC. An O(v~-) parallel algorithm on a fn- x d/n- MCC is given for solving that problem. This is the first solution on a v~- × x/n MCC to achieve an asymptotically optimal 0 ( ~ - ) running time for L l and Loo metrics. Once this Voronoi diagram is available, we can solve, all in O(~/-~) time, many proximity problems such as the nearest neighbor, the largest empty circle, the smallest enclosing circle, Delaunay triangulation (in L 1 and Loo metrics), etc. The outline of the paper is as follows. In Section 2, we introduce some basic definitions and properties of the Voronoi diagram and explain basic operations on MCC. In Section 3, we describe how to construct the merge curve and in Section 4 present an O(~fn-) parallel algorithm for the Voronoi diagram in the L 1 and L~ metrics. Finally, we give a conclusion in Section 5.
2. Preliminaries
We first define the Lp metric and introduce some notations. Given two points qr and qj in the plane R 2 with coordinates (x r, Yi) and (x j, yj), respectively, the distance between qr and qj in the Lp metric is defined as dp(qr, qj) = ( Ix i - xj[ p + [Yi -Yj[ p)l/p for p = 1, 2 . . . . and doo(qi, qj)=max(Ixi-xil, lyr-yjl)- The plane in which the Lp metric is the distance measure is denoted by R~. The bisector Bp(qr, qj) of two points qr and qj is the locus of points equidistant from qr and qj, i.e. Bp(qi, qj) = ( r l r ~ R 2, dp(r, qi) = dp(r, qj)}. Two points qr and qj are called bisector points of the bisector Bp(qi, qj). The bisector Bp(qi, qj) is said to be oriented if a direction is imposed on the bisector so that qi and qj lie to the left and to the right of it, respectively. If the bisector Bp(qi, qj) is oriented, we call qr and qj left and right bisector points of Bp(qr, qj), respectively. The bisector segment of two points qr and qj, denoted B_p(qi, qj) is a continuous portion of the bisector Bp(qr, qj), i.e. _Bp(qr, qj) c_ Bp(qi , qj). The bisector Bp(qr, qj) of qi and qj is either nonincreasing or nondecreasing [1]. Therefore, the bisector Bp(qi, qj) is unbounded and partitions the plane into two unbounded halfplanes. The locus of points closer to q; than to qj, denoted by hp(qi, qj), is one of the halfplanes containing qi that is determined by the bisector Bp(qr , qj), i.e. hp(qi , qj) = {r[dp(r, qr) <~ dp(r, q-i)). Given a set S of points ql, q2 . . . . . qn, the locus of points closer to qr than to any other point, denoted by V~(qr ), is called the Voronoi region or polygon associated with qr in the Lp metric and is thus given by V~(qr ) = Ni,-iht,(qi, q-i), the intersection of all the halfplanes containing qv The entire set of Voronoi polygons partitions the plane into n regions and is 2 referred to as the Voronoi diagram Vp(S) for the set S in Rp. The edges in Vp(S) are called Voronoi edges and the two end vertices of each edge in Vp(S) Voronoi vertices. Each Voronoi edge is shared by two Voronoi regions V~(qi ) and V~(q-i) and is a bisector segment B__p(qi, q i). The Voronoi edge _Bp(qr, q-i) is represented by two bisector points qr and q-i and two end vertices or and vj. The Voronoi edge B_p(qi, q-i) is said to be unbounded if one of its end vertices or or oj lies at infinity. The end vertex that lies at infinity is
Voronoi diagram on a mesh-connected computer
243
ql/ c Fig. 1. Voronoi diagram V1(S ) and merge curve C. referred to as an unbounded vertex. Consider a partition of S into two subsets L and R that lie to the left and to the right of a vertical line respectively. Let C be the collection of edges in Vv(S ) which are shared by polygons of points in L and polygons of points in R. We shall orient C so that the points in L and R lie to the left and fight respectively as the edges of C are traversed from b o t t o m up, and refer to C as the merge curve of L and R. The merge curve C is monotone with respect to y axis, and all the points that lie to the left of C are closer to L and all the points that lie to the right are closer to R. Fig. 1 shows the Voronoi diagram Va(S ) and the merge curve C. Throughout the paper, we only consider the problem of constructing Voronoi diagram in L 1 metric. The case for L ~ metric is similar to L 1 metric. F r o m now on, we shall omit p in the notation for simplicity. The M C C is divided into four blocks I, II, III, and IV of equal size (Fig. 2). Each block is then recursively divided into four subblocks in a similar manner until each subblock contains just one PE. To be more precise, the blocks are defined below. Let bitp(i) denote the coefficient of 2 v in the binary representation of i = ~v>~obitv(i)2v. If we represent each PE with index i by its binary representation, a 2V-block of PE's consists of 2 a consecutive PE's whose indices differ only in the least significant p bits. For example, PE's with indices 0 through 2 v _ 1 form a 2 P-block, the next 2 v PE's form another 2 P-block, etc. A 2 P-block is called a zero 2 P-block if it contains only PE's with indices i whose bite(i ) = 0 and a one 2P-block if it contains only PE's with indices i whose bitv(i ) = 1. A 2P+Lblock consists of two sibling blocks, a zero 2 P-block and a one 2 P-block. Thus each PE is a 2°-block, and a ~ x ¢%- M C C itself is a (zero) 2k-block, where 2 k = n. Blocks I and II mentioned above are sibling blocks and they together form a zero 2 k- a-block, and similarly blocks III and IV are sibling blocks that together form a one 2 k- l-block. The divide-and-conquer approach to be applied on a 7~- × ~ - MCC, where 2 k = n, can be briefly described as follows: First the given problem is divided into two subproblems, stored in two sibling (zero and one) 2 k- a-blocks respectively. We then recursively solve in parallel the subproblems in each 2k-a-block. In order to make the timing analysis more clear, the subproblem associated with each of the two 2 k- a-blocks is further divided into two subsub-
I
II
III
IV
Fig. 2. Four blocks I, II, III, and IV on MCC.
244
C.S. Jeong
problems stored in two sibling subblocks of size 2 j'-2, each occupying a ¢~-/2 x ~fn-/2 mesh. Thus the total time needed to solve a problem on a ~ x fn- M C C can be expressed as T(V%, ~/~-) = T(¢~-/2, ~/~-/2) + M 1 + M 2, where M 1 denotes the time for merging the solutions in the sibling 2 k-2-blocks (corresponding to blocks I and II and to blocks I I I and IV) and M 2 the time for merging the solutions in the sibling 2 k - L b l o c k s (corresponding to blocks I U II and III W IV). If the solutions obtained in the subblocks can be merged in O(fn-) time, i.e. M 1 + M 2 = O ( f ~ ) , the overall time complexity given by the recurrence relation T ( v ~ , ~/-n) = T ( f ~ / 2 , f n / 2 ) + O(v~), is O(v/-n). Therefore, the main issue in the design of an O ( v ~ ) parallel algorithm on an M C C resides in how to implement the merge step in O(v~-) time. Since the first phase ( M a) of the merge step is similar to the second phase ( M 2) and both can be done within the same time, we shall describe below only the second phase and suffice it to show that it can be done in O ( v ~ ) time. In what follows, we shall assume that after an appropriate dividing step of the given problem on a v ~ x f n MCC, where n = 2 k, the subsolutions residing in the zero 2 k- Lblock and one 2 k- Lblock are referred to, for short, as the left and right blocks respectively. The following well-known operations on M C C such as sorting, R A R (random access read) and RAW (random access write) [11,12] are used throughout this paper. Given two sorted lists A = (al, a 2. . . . . a,,) and B = (b 1, b 2. . . . . b,), we define the predecessor of a i as the least element bj in B previous to a i in the sorted list of A and B, i.e. bj<~ a t < bj+a. If there is no such bj, we assume its predecessor is the least element b,, in B. The P R E C E D E operation computes, for each element a i in A, its predecessor in B. This can be done in O(v/-n) by sending each bj to every PE containing a t such that ~_~< ai < bj+] after merging A and B. All the above operations take O(fn-) time on a ~ x ~/n M C C indexed in shuffled row-major order. We shall use divide-and-conquer technique to construct the Voronoi diagram V~( S ) for a set S of n points in the plane R 2. Suppose each PE contains a point of S on a ~ x V%- MCC. We first sort the points in S in nondecreasing order of the x-coordinate and divide S into disjoint subsets L and R such that L and R contain the leftmost [n/2] points and the rightmost [n/2] points respectively. Recursively construct the Voronoi diagram V1( L ) and V1(R) for sets L and R, respectively in the left and right blocks of the MCC. We merge them to form V1(S ) by constructing a merge curve C oriented so that any point to the left of C is closer to some point in L and any point to the fight is closer to some point in R. During the computation of the merge curve, the portion of edges in V(L) (and V(R)) which lie to the right (and left) of the merge curve is discarded. If the time taken for the merge of two Voronoi diagrams in the left and right blocks is O(q~), the overall time complexity is O(v~). Therefore, the main problem is reduced to how to construct the merge curve in O(~/-~) time to achieve optimal time complexity. In the next section we shall explain how to construct the merge curve in detail.
3. Constructing the merge curve
While in the merge step of the sequential algorithm, the merge curve is computed in linear time by a sequential clockwise and counterclockwise scan, our algorithm constructs the merge curve by first locating the set B of edges of V ( L ) and V(R) which are intersected by the merge curve and then arranging the edges in B according to the order in which they are intersected by the merge curve. The merge curve C in the Lp metrics for 1 < p < co is continuous and has two unbounded edges at both ends. But, in the L] or Loo metric, the merge curve C may be discontinuous and divided into several pieces, each of which consists of one or several edges (Fig. 8). Therefore, the construction of the merge curve C in the L a and Loo metrics is more
245
Voronoi diagram on a mesh-connected computer
r
=7 \
I
n6 / 2
I
Fig. 3. R T ( S ) and V(S).
complicated than in the Lp metrics, for 1 < p < ~ . In the following subsections, we shall elaborate on how to construct the merge curve for L 1 metric.
3.1. Starting and terminating bisectors We shall first compute the bisectors corresponding to those unbounded edges of the merge curve C each of which is either a starting edge or a terminating edge of a piece when we traverse the merge curve in the oriented direction. Let A, and C, be the sets of the unbounded edges, respectively, in V(S) and C. Clearly, C. c_ A,. Note that C, is the set of starting and terminating edges. Let R T ( S ) be the smallest rectangle containing S and RT(S) the region outside RT(S). Then, we have the following lemma [3] (Fig. 3): Lemma 1. Every edge e in A, (or C,) is intersected by RT( S) and the portion of e in RT( S) is an unbounded vertical or horizontal line with one endpoint on RT( S). Let A t and A r be the sets of unbounded edges in V ( L ) and V(R), respectively. Since R T ( L ) and R T ( R ) are contained in RT(S), we have the following corollary (Fig. 4): Corollary 1. Every edge e in A t and A r is intersected by RT( S) and the portion of e in RT( S) is an unbounded vertical or horizontal line with one endpoint on RT( S).
3
e 4 -- _ ~q.-f e ¢
5 6
l i
o-q
e
q 6 ." "-7 ( / / •q4 gq5 oq 3
f
/\
I/
q8
e7 Fig. 4. V(L), V(R), and R T ( S ) .
q9
2 1
e9 e 8
C.S. Jeong
246
e~ l
!
Po=r(q,,q,)
R2 = r(q,,qT) --
e-t
~
i
--
--In,,-
¢2
--
R~ = r(q,,qg)
R, = r(qt,q6)
R~ = r(q~,qg)
C~
R.~= r(q2,q,)
R, = r(q3,q~)
R, = r(q2,q,)
R, = r(q3,q,) 6~
Fig. 5. A set D for V ( S ) i n Fig. 4.
By Corollary 1, the edges in A / divide RT(S) into regions each of which lies in a Voronoi region of V(L). Similarly, the edges in A~ divide RT(S) into regions, each of which lies in a Voronoi region of V(R). Therefore, the edges in A = A t U A r divide RT(S) into a set D of regions, each of which lies in the intersection of a Voronoi region V(qi ) in V(L) and a Voronoi region V(qj) in V(R), denoted r(qi, qj) (Fig. 5). By L e m m a 1, the portion of every edge e of C, in RT(S) lies in at least one region of D. Also, it is easy to see that if the intersection of the region r(q i, qj) in D and the bisector B(q i, qj) is not empty, then the unbounded edge corresponding to the bisector B ( q , qj) is in C,. Therefore, we have the following lemma. I
Lemma 2. An edge B(qi, qj) is in Cu if and only if the intersection of r(qi, qj) in D and B(qi, qj) is not empty. L e m m a 2 tells the fact that once we compute, for each region R~ in D, two points qi, and qi, such that R i lies in the intersection of V(qi,) in V(L) and V(q,.) in V(R), i.e. R i = r(qi,, q~2)' we can easily find the bisectors corresponding to all the unbounded edges in C,. Lemma 3. All the single pieces and all the starting and terminating bisectors of non-single pieces
can be computed in O(fn ) time. Proof. We first compute A / and A r by locating those edges, respectively in V(L) and V(R) that are intersected by RT(S). This can be done in O(fn-) time by sending four boundary edges RT(S) to the PE's containing the edges in V(L) and V(R). (If an edge e in A = A l g a r is unbounded at both ends, it intersects R T ( S ) at two locations, and the portion of e in RT(S) is divided into two line segments. In that case, we generate two copies of e corresponding to each portion of e.) Next, we sort all the edges in A = A t U A r in counterclockwise order around the rectangle RT(S) starting from an arbitrary edge in A. Let .4 = (el, e 2. . . . . era) be the resulting sorted list and D = (R1, R 2. . . . . R,,) be the set such that R i is a region between e i and ei+ 1, 1 ~< i < m and R,, between e m and e 1 (Fig. 5). The edges e 1 and em are referred to as the least and greatest edge respectively. We want to find, for each region R i, its two associated points qi, and q , such that R i = r(qi,, qa,) (Fig. 6). We assume that each edge in A is directed outward from inside RT(S). Each PE containing e i computes qi, and q6 of R~. We can easily observe the following facts: Suppose e i is in A/. Let eg, be the greatest edge in Ar which is previous to e i in the sorted list A. Then, for each Ri, qi~ and qi2 are the left bisector points of e i and eg, respectively. If there exists no such edge in A~ previous to e i, then eg i denotes the least edge in
Voronoi diagram on a mesh-connected computer V(L)
V(qO
247
V(R)
Rs=r(q~,q0 V(q,)
~-- e9 R* = r(q,,qg)
V(q,)
--I1~ ¢.,
R, = r(q3,q,)
e,
V(q,)
R, = r(q2,q0 V(q2)
V(q,)
R~= r(q2,q0
- ~ e~ ,~ e~ J V(q,)
R, = r(q~,q0
-.D~ e,
lh = r(q,,q,) Ra= r(q,,q0 V(q,)
%.
]
es I V(q,) e2
R~= r(q,,q0 e,
V(q,)
V(q,) Fig. 6. A sorted list A. A r, and q~, and q~.. are the left and fight bisector points of e~ and eg, respectively. The other case when e~ is in A r is symmetric. Therefore, we can find, for each e~ is in A / and A r, q~, and q~, in O(~/~) time by P R E C E D E operation. "Let M be the set of the bisectors corresponding to the unbounded edges in (7,,. We can compute M in O(1) time by Lemma 2 by checking, for each region R~ = r(q~,, q~,), whether the intersection of B(q~,, q~,) and r(qg¢ q~2) is empty or not. Let p be the intersection point of B(qi,' q~2) and RT(S) in r(qi,, qi2)" We can easily see that the bisector B(qi,, qi,) is a starting bisector if it is oriented in the direction from infinity to p in r(q~,, q~..); otherwise a terminating bisector. Therefore, we can determine in O(1) time, for each bisector B(qi,, q~.) in M, whether it is a starting or terminating bisector. Note that the edge corresponding to the bisector B(qi,, q~.) is unbounded at both ends and hence a single piece itself if and only if B(qi,, q~,) appears two times in M. Therefore, we can find every single piece from M by locating bisectors B(qi,, q~.) that appear two times in M. This can be done in O ( f n ) time using RAW. If we discard all the bisectors corresponding to the single pieces from M, then M becomes a set of starting and terminating bisectors of non-single pieces. []
3.2. Finding the set of edges intersected by the merge curve In this subsection, we show how to compute the set B of edges intersected by the merge curve C. We first decide, for each edge e~ in V(L) and V(R), whether its end vertices are closer to L or R, and then, from that information, determine whether e~ is intersected by the merge curve. Suppose an end vertex o~l of the edge eg=B_(qn, qn) of V(L) lies in the Voronoi region V(qj) of V(R). Since q~l (or qn) and qj are points, respectively, in L and R closest to v~t, we can decide if v~l is closer to L or R. Similarly, we can determine, for each end vertex v~ of edges in V(R), whether v~ is closer to L or R if we know the Voronoi region of V(L) containing vit. Therefore, the problem is reduced to point location, i.e. for each Voronoi vertex v~ in V(L) and V(R), find the Voronoi region in V(R) and V(L) respectively that contains v~. We only consider the set Vt of end vertices in V(L) since the other case is similar. The set V~ is divided into two sets Vb and V,, that consist of bounded and unbounded end vertices
C.S. Jeong
248
RT(S) v; ,
Iv'.
1
e i
p
oi
Fig. 7. Illustration of L e m m a 4.
respectively. The Voronoi vertices in V0 can be determined to be closer to L or R in O(v%-) time by executing planar point location [9,10]. For each vertex in V,, we use the following lemma to decide whether it is closer to L or R. Lemma 4. Let e, be an edge in A with an unbounded end vertex v i. Let Pi be a point on e i inside R T ( S ) and v" be the intersection point of R T ( S ) and portion of e i between p~ and v i. v i is closer to a point in L ( R ) if and only if v" is closer to a p o i n t in L ( R ) . Proof. Suppose v~ is closer to a point q,' in L but vs is closer to a point qs in R (Fig. 7). F r o m I t t ! I the fact that d ( v i, qi) = d(oi, oi) -t- d ( o i , qi) in L 1 metric and d ( v i, qi) > d ( ° i , qi ), we have t I ! t d( vi, qi) > d( vi, vi ) + d( vi, qi ) = d( vi, qi ), making contradiction. Assume that v i is closer to a point q~ in L, but v~ is closer to a point q~' in R. Similarly, we have d(v~, q~)= d(v~, o f ) + t ! I t t d( v,, qi) > d( v~, v i ) + d( vi, qi ) = d( vi, qi ), making contradiction. Similarly, we can prove the other case. [] Lemma 5. For each unbounded end vertex v i of an unbounded Voronoi edge in L 1 metric, we can determine in O(~/-n ) time whether it is closer to L or R. Proof. By L e m m a 4, we can substitute v" for any unbounded end vertex v~ in II, to test whether v, is closer to L or R. Let V,,' be the set of points obtained after replacing every unbounded end vertex v~ of Vu with v~. By executing planar point location for each point o,' in V,', we can determine whether v~ is closer to L or R by L e m m a 4. [] Next, we want to determine, for each edge e~ in V ( L ) and V ( R ) , whether it is intersected by the merge curve C. The set of edges E = E~U E r can be partitioned into three subsets as follows: Eu: the set of edges with both of its end vertices closer to L. Err: the set of edges with one end vertex closer to L and the other to R. Er~: the set of edges with both of its end vertices closer to R. We shall consider, for each e~ in E, the above three cases, to decide whether it is intersected or not by C. Let E t and E~ be the sets of edges in V ( L ) and V ( R ) respectively. Then, we have the following lemma. Lemma 6 [9,10]. For e i in E/(Er), the following properties hold: (1) C does not intersect e i in EIt(Er~ ). (2) C intersects e i in Et~ exactly once. (3) I f C intersects e i in E ~ ( E u ) , it does so twice.
Voronoi diagram on a mesh-connectedcomputer
249
Consider a Voronoi edge e=_B(pi ,, P,2) with two end vertices v~, and vi2 such that the y-value of v~l is smaller than that of v;2 and let it be directed from v~, to vg2. Let p~, and p~, lie to the right and left of eg respectively. 7 [9,10]. Suppose e i = B ( Pi~, Pi,.) is an edge in V( L ) (V( R )) such that both vi~ and vi2 are closer to R ( L ) than to L ( R ) . Let qi be the intersection of B(pi,, Pi,) and the horizontal line l passing through Pi,( Pi2)" Then, qi ~ ei and is closer to L ( R ) if and only if e i intersects the merge curve C twice. Lemma
8. All the edges in V( L ) and V( R ) intersected by the merge curve can be computed in O(x/n ) time in L 1 metric. Lemma
Proof. We first decide, for each endvertex of edges in V(L) and V(R), whether it is closer to L or R. This can be done in O(¢n) time by using planar point location for both of bounded and unbounded vertices by lemma 5. Then, we can determine, for each edge in V(L) and V(R), in O(~fff) time whether it is intersected or not from Lemmas 6 and 7. 3.4. Computing the edges of the merge curve We can sort the set B of edges in the order intersected by the merge curve in O(vC~) time using the method in L 2 metric [9,10]. Now, we are going to find the edges of the merge curve from the sorted list B. Note that the merge curve C is the collection of edges in V ( S ) which are shared by polygons of points in L and polygons of points in R, and hence each edge in C is the bisector segment of two points, one in L and the other in R. Therefore, once we compute, for each edge e in C, the Voronoi regions of V(L) and V(R) where e lies, we can find the bisector points of e. In L 1 metric, the merge curve C may be divided into several pieces. Each piece is either a single unbounded edge or consists of several edges with two unbounded edges at both ends. Fig. 8 shows an example of the discontinuous merge curve which consists of two pieces. After sorting, B may consist of several parts ( B 1, B2,..., B k } such that each part B~ is a sequence of edges intersected by a piece of the merge curve (Fig. 9). We use the starting and terminating bisectors of M to determine the first and last edges of each part that are intersected
I •
I I
•
J
I
I• i •
C Fig. 8. An example of the discontinous merge curve.
250
C.S. Jeong
"k I tti B. 1
f e, im
¢
eim @ im-I
t t¢ e'i2
e i2 @ i!
si
Bi-I[ i B1
[I" Fig. 9. A sorted list B.
respectively by starting and terminating unbounded edges of the corresponding piece. We use those first and last edges of each part as delimiters between adjacent parts of B. In case e~ in B is intersected twice by C, we divide e~ into two parts e 6 and e~2 such that each of two parts has one end vertex closer to L and the other closer to R and is intersected by C once. We assume that each edge in B is directed from one end vertex closer to L to the other end vertex closer to R. Lemma 9. Given the set M of starting and terminating bisectors of non-single pieces and the sorted list B, the bisector points and end vertices of all the edges of the merge curve C in L 1 metric can be computed in O ( f n ) time. We shall find the first edge of each part of B by computing those edges of B that are intersected by the unbounded edges corresponding to the starting bisectors in M. We can easily see that the edge e of B that is intersected by the unbounded edge corresponding to the starting bisector B(qr, qi~) is the least edge among those edges whose right bisector points are qi, or q~. We send the edges in B with right bisector points qi, or q~ to the PE containing B(q~,, q,). This can be done in O ( f ~ ) time by using RAW operation~ Let B' be the set of edges of B which are sent to the PE containing B(q~,, q,:). During RAW, we can find, for each starting bisector B(q~,, q,2), the least edge e i among those edges in B'. Similarly, we can compute, for each terminating bisector, the edge that is intersected by the unbounded edge corresponding to that terminating bisector. Therefore, we can find the first and last edges of every part of B in O(v~) time. Let M/ and M / be sets of all the first and last edges of B respectively. Let B i = ( e~,, e~:,..., ei., } be a part of B such that e 6 or e~., are the first and last edges of that part and s, and t~ are the starting and terminating bisectors which intersect ei, and e~., respectively. The PE's containing e~, and ei., also store s~ and t~ respectively. Therefore, we can compute, for each B~, starting (terminating) edge in O(1) time by computing the intersection point of s~ and Proof.
251
Voronoi diagram on a mesh-connected computer t
t
t
t
ei.~). Let E i = (e,_ . . . . . e~.} be the set of edges in the merge curve C such that e,~ lies between e~_, and e~. We want to find, for each e~' in Ei', its two bisector points qk, and qkz in L and R respectively. Each PE containing ei~ computes two bisector points qk, and qkei' as follows: We only consider an edge e~, in V(L) since the other case is similar. Let F be the set obtained from B by replacing the first edge e~, of each part B~ with s r Let eg,~ be the greatest edge of F - V(L) that is previous to e~ in the list F. Note that e~,~ is the nearest edge either in V(R) or in M I that is previous to ei. Therefore, qk, and qk~ a r e the right and left bisector points of e i and eg respectively if eg is not in M/; otherwise the right bisector points of e~ and e_ respecnvely, since e,. hes m V(q~ ) of V(L) and V(q k ) of V(R). This can be done in O(~/~-) time by the P R E C E D E operation. After computing bisector pomts for each edge el'k in the merge curve, we can find their end vertices in O(Tn-) time by computing the intersection points with adjacent edges ei~_, and e~ using RAR. [] •
.
•
k
•
k
tk.
~t K
•
t
•
t k
k
.
1
•
•
2
.
4. Parallel algorithm for Voronoi diagram In this section we briefly describe a parallel algorithm for computing two dimensional Voronoi diagram in LI(L~) metric•
Parallel algorithm Voronoi Input: A set S of n planar points are distributed on a ~ - × ~ MCC, one point per PE. Output: A set of Voronoi edges specified by their two end vertices and bisector points. 1. Sort all the points in S by x-values. Let L and R be the sets of points in the left and right blocks respectively• 2. Construct the Voronoi diagrams V(L) and V(R) recursively for L and R in the left and right blocks respectively• 3. Merge the Voronoi diagrams F ( L ) and F ( R ) by constructing the merge curve C and discarding the portion of edges in V(L) and V(R) to the right and left of the merge curve respectively as follows• 3.1. Find the set B of edges in F ( L ) and F ( R ) which are intersected by C. 3.2. Discard those edges in F ( L ) and V(R) which lie totally to the right and left of C respectively. 3.3. Sort all the edges in B according to the order in which they are intersected by C. 3.4. Compute the bisector points and end vertices of all the edges in C from the sorted list B. 3.5. Replace the right and left end vertices of e~ in B t and Br respectively with the intersection point between e i and C, where Bt(Br) is the set of edges in B ~ V ( L ) ( B A V(R)). 3.6. Distribute the edges of V(S) together with their end vertices and bisector points so that each PE contains a constant number of Voronoi edges. End algorithm. Theorem. Given a set S of n planar points, the Voronoi diagram for L1( L~) metric can be constructed in O ( f n ) time on a ~ × v~ MCC. Proof. The correctness and the time complexity follow from the previous discussions.
[]
5. Conclusion In this paper we have shown that the Voronoi diagram for a set of n points in the plane for × ~ MCC. The main issue lies in how to construct the merge curve in O(~/~-) time. The merge curve in Lp metrics, 1 < p < o¢, is
La(Loo ) metric can be constructed in O(fn-) time on a ~
252
C.S. Jeong
c o n t i n u o u s a n d has two u n b o u n d e d edges at b o t h ends. H o w e v e r , the m e r g e c u r v e in L 1 o r Loo metrics m a y be d i s c o n t i n u o u s a n d d i v i d e d into several pieces, a n d h e n c e is m o r e c o m p l i c a t e d to c o m p u t e . T h e merge curve in L l(Lo~ ) m e t r i c has been c o n s t r u c t e d b y first l o c a t i n g s t a r t i n g a n d t e r m i n a t i n g bisectors a n d the Jet B of edges i n t e r s e c t e d b y the m e r g e curve. A f t e r s o r t i n g B in the o r d e r i n t e r s e c t e d b y the m e r g e curve, the edges of the m e r g e curve h a v e b e e n c o m p u t e d . T h e starting a n d t e r m i n a t i n g bisectors have b e e n used to d e t e r m i n e the first a n d last edges of each piece, a n d as d e l i m i t o r s for d i s t i n g u i s h i n g d i f f e r e n t pieces o f the m e r g e curve. By the V o r o n o i d i a g r a m , we can c o m p u t e , all in O(~/-n-) time, m a n y p r o x i m i t y p r o b l e m s such as a l l - n e a r e s t - n e i g h b o r s , the largest e m p t y circle, D e l a u n a y t r i a n g u l a t i o n , etc., w h e r e the d i s t a n c e m e a s u r e s are L1 o r too metrics.
References [1] M.I. Shamos, and D. Hoey, Closest point problems, Proc. 16th Syrup. of Foundations of Comput. Sci. (1975) 152-162. [21 F.K. Hwang, An O(n logn) algorithm for rectilinear minimal spanning trees, J A C M 26 (1979) 177-182. [3] D.T. Lee and C.K. Wong, Voronoi diagrams in L l(Loo) metrics with 2-dimensional storage applications, S I A M J. Comput. (1980) 200-211. [4] D.T. Lee, Two dimensional Voronoi Diagrams in the Lp metric, J A C M 27 (1980) 604-618. [5] A.L. Chow, Parallel algorithms for Geometric problems, Ph.D. Thesis, Dept of Comput. Sci., Univ of Illinois at Urbana, 1980. [6] M. Lu, Constructing the Voronoi diagram on a mesh connected computer, Proc. 1986 lnternat. Conf. on Parallel Processing (1986) 806-822. [7] K.Q. Brown, Voronoi diagrams for convex hulls, Inform. Process. Lett. 9 (1979) 223-228. [8] A. Aggarwal, B. Chazelle, L. Guibas, C. O'dunlaing and C. Yap, Parallel computational geometry, Proc. 26th IEEE Syrup. on Foundations of Computer Science (1985) 468-477. [9] C.S. Jeong and D.T. Lee, Parallel geometric algorithms on a mesh connected computer, FJCC (1987) 560-567. [10] C.S. Jeong and D.T. Lee, Parallel geometric algorithms on a mesh connected computer, Algorithmica 5 (1990) 155-177. [11] D. Nassimi and S. Sahni, Data broadcasting in SIMD computers, IEEE Trans. Comput. (1981) 101-106. [12] C.D. Thompson and H.T. Kung, Sorting on a mesh-connected parallel computer, Comm. A C M 20 (1977) 263-271.