Iterated Nearest Neighbors and Finding Minimal Polytopes* 1
Total Page:16
File Type:pdf, Size:1020Kb
Iterated Nearest Neighb ors and Finding Minimal Polytop es y z David Eppstein Je Erickson Abstract Weintro duce a new metho d for nding several typ es of optimal k -p oint sets, minimizing p erimeter, diameter, circumradius, and related measures, by testing sets of the O (k ) nearest neighb ors to each p oint. We argue that this is b etter in a number of ways than previous algorithms, whichwere based on high order Voronoi diagrams. Our technique allows us for the rst time to eciently maintain minimal sets as new p oints are inserted, to generalize our algorithms to higher dimensions, to nd minimal convex k -vertex p olygons and p olytop es, and to improvemany previous results. Weachievemany of our results via a new algorithm for nding rectilinear nearest neighb ors in the plane in time O (n log n + kn). We also demonstrate a related technique for nding minimum area k -p oint sets in the plane, based on testing sets of nearest vertical neighbors to each line segment determined by a pair of p oints. A generalization of this technique also allows us to nd minimum volume and b oundary measure sets in arbitrary dimensions. 1 Intro duction Anumb er of recent pap ers have discussed problems of selecting, from a set of n p oints, the k points optimizing some particular criterion [2, 14, 20]. Criteria that have b een studied include diameter [2], variance [2], area of the convex hull [20], convex hull p erimeter [14,20], and rectilinear diameter and p erimeter [2]. Such problems are useful in clustering, line detection, statistical data analysis, and other geometric applications. We study and improveknown algorithms for these problems. Wealsointro duce dynamic versions of these problems, in which the optimum set must b e maintained as new p oints are inserted. Our metho ds further generalize to higher dimensional versions of these problems. Our techniques apply to all of the problems cited ab ove. Portions of this pap er were presented at the 3rd and 4th ACM-SIAM Symp osia on Discrete Algorithms [17, 19]. This pap er includes work done while Je Erickson was at the Universityof California at Irvine. David Eppstein's researchwas partially supp orted by NSF grant CCR-9258335. y Department of Information and Computer Science, University of California, Irvine, CA 92717 z Computer Science Division, University of California, Berkeley, CA 94720 1 2 D. Eppstein and J. Erickson Many of these problems were previously solved using the following metho d, orig- inally develop ed byDobkin et al. [14]. An ad ho c algorithm was determined, with c time b ounded by a p olynomial O (n ). Then, it was shown that the optimum k -p oint set is contained in the set of p oints lab eling a single region of the order-O (k )Voronoi diagram. Constructing the Voronoi diagram and searching the O (kn) such regions c+1 takes a total time of O (n log n + k n). Aggarwal et al. [2] reduced the number of c regions to b e searched from O (kn)to O (n). Thus the time b ecomes O (n log n + k n). However, there remains an anomaly in these time b ounds: if k is (n), the time c is worse than the original O (n )by a factor of n.Thus at some p oint the device of higher order Voronoi diagrams b ecomes worthless, and one must use a simpler algorithm. We argue that, in this formulation, Voronoi diagrams should b e replaced bysets of the O (k ) nearest neighb ors to eachpoint. There are several reasons whywe b elieve this. First, the reduction to O (n) regions to b e searched is immediate, and avoids the complicated analysis of Aggarwal et al. [2]. Second, by nding neighb ors of neighbors, we show that the numb er of regions can b e further reduced to O (n=k ), improving the time b ounds by a factor of k and eliminating the anomaly describ ed ab ove. Third, our time b ounds can b e improved in a di erentway. The k nearest neighb ors can b e found in time O (kn log n), using Vaidya's algorithm [34]. For the rectilinear (L or L ) metric, we further improve this to O (n log n + kn) on a random 1 1 access machine. Thus we get faster time b ounds in the plane, even for problems such as circumradius for which the reduction to Voronoi diagrams is immediate. Fourth, our metho d lends itself well to dynamization. As p oints are inserted one at a time, the neighb ors of eachnewpointmay b e computed quickly using standard techniques. In contrast, the Voronoi diagram maychange byasmanyas (n) edges at each insertion. Dynamic algorithms have b een studied for many imp ortant geo- metric optimization problems, such as the closest pair, diameter, minimum spanning tree, and convex hull, but this is the rst time that dynamic algorithms have b een describ ed for minimum measure subset problems. Fifth, our approach generalizes to higher dimensions in a way that do es not work for Voronoi diagrams. In dimension d,even rst order Voronoi diagrams can dd=2e have complexity (n ); whereas, the nearest neighb ors can still b e found in time O (n log n) using Vaidya's algorithm [34]. Finally,by applying an old combinatorial result of Erd}os and Szekeres [21], we can generalize our techniques to nd minimum measure convex p olygons and p olytop es. Avariant of our technique also yields new algorithms for nding minimum area k -p oint sets in the plane, or minimum b oundary measure or volume k -p oint sets in arbitrary dimensions. Our b oundary measure algorithm is a natural generalization of our minimum p erimeter result. Instead of using the neighb ors to each p oint, we Nearest Neighb ors and Minimal Polytop es 3 Measure Static time b ound Dynamic time b ound 2 3 4 p erimeter O (n log n + k n) O (k +log n) 2 2 3 L p erimeter O (n log n + k n) O (k +log n) 1 2 2 circumradius O (n log n + kn log k ) O (k log k +log n) 2 2 2 2 3 diameter O (n log n + k n log k ) O (k log k +log n) 2 2 2 L diameter O (minfn log n + kn; n log ng) O (k log k +log n) 1 2 3=2 3=2+" 3+" variance O (k n log n + k n) O (k + log n) 2 3 2 area O (n log n + k n ) | Table 1. New results for nding minimum measure k -p oint sets, given n p oints in the plane. (" is an arbitrarily small p ositiveconstant.) let each set of r points in the set de ne a particular p olytop e, for some constant r de ned by the measure we are trying to minimize, and we examine the nearest neighb ors to each p olytop e thus de ned. In particular, weshow that the minimum area k -p oint set is contained in the O (k ) nearest vertical neighbors to a line segment determined bytwo of its p oints. 2 New Results We present algorithms for the following problems. We nd the k nearest rectilinear (L or L ) neighb ors to eachofasetofn 1 1 points in the plane, in time O (n log n + kn), improving the previous O (kn log n) b ound [34]. 2 We nd the k nearest vertical neighb ors to each of the O (n ) line segments 2 2 determined by pairs of p oints in an n-p oint set, in total time O (kn + n log n). Given a set of n points in the plane, we nd the k -p oint set minimizing p erime- ter, L p erimeter, circumradius, diameter, L diameter, variance, or area. 1 1 Our results are summarized in the rst column of Table 1. Weimprove all previous results [2, 14, 20], except for variance and area, whichweimprove for certain values of k . We maintain minimal p oint sets in the plane as p oints are inserted, under avariety of \one-dimensional" measures. Our results are summarized in the second column of Table 1. No previous b ounds are known for any of these problems. d Givenasetofn points in IR , with d> 2, we nd the k -p oint set min- imizing circumradius, diameter, L diameter, variance, b oundary measure, 1 4 D. Eppstein and J. Erickson Measure Time b ounds 2 d1 circumradius O (kn log n + k n log k ) O (k ) diameter O (kn log n +2 n) 2 d=21 L diameter O (kn log n + k n log k ) 1 2 (d+1)=2 O (d ) variance O (k n log n + k n log k ) d O (k ) d1 b oundary measure O (n +2 n ) d 2d1 d1 L b oundary measure O (n + k n ) 1 d+1 d O (k ) d volume O (kn log n +2 n ) d Table 2. New results for nding minimum measure k -p oint sets, given n points in IR , for all d> 2. L b oundary measure, or volume. Our results are summarized in Table 2. We 1 improve previous algorithms for circumradius and variance based on Voronoi d+1 diagrams, which run in time O (n ) [2]. No previous b ounds were known for the other problems. We generalize all of our results to k -p ointconvex p olygons and p olytop es.