Space Exploration via Proximity Search

We investigate what computational tasks can be performed on a point set in $\Re^d$, if we are only given black-box access to it via nearest-neighbor search. This is a reasonable assumption if the underlying point set is either provided implicitly, or it is stored in a data structure that can answer such queries. In particular, we show the following: (A) One can compute an approximate bi-criteria $k$-center clustering of the point set, and more generally compute a greedy permutation of the point set. (B) One can decide if a query point is (approximately) inside the convex-hull of the point set. We also investigate the problem of clustering the given point set, such that meaningful proximity queries can be carried out on the centers of the clusters, instead of the whole point set.


Introduction
Many problems in Computational Geometry involve sets of points in R d . Traditionally, such a point set is presented explicitly, say, as a list of coordinate vectors. There are, however, numerous applications in science and engineering where point sets are presented implicitly. This may arise for various reasons: (1) the point set (which might be infinite) is a physical structure that is represented in terms of a finite set of sensed measurements such as a point cloud, (2) the set is too large to be stored explicitly in memory, or (3) the set is procedurally generated from a highly compressed form. (A number of concrete examples are described below.) Access to such an implicitly-represented point set P is performed through an oracle that is capable of answering queries of a particular type. We can think of this oracle as a black-box data structure, which is provided to us in lieu of an explicit representation. Various types of probes have been studied (such as finger probes, line probes, and X-ray probes [Ski89]). Most of these assume that P is connected (e.g., a convex polygon) and cannot be applied when dealing with arbitrary point sets. In this paper we consider a natural choice for probing general point sets based on computing nearest neighbors, which we call proximity probes.
More formally, we assume that the point set P is a (not necessarily finite) compact subset of R d . The point set P is accessible only through a nearest-neighbor data structure, which given a query point q, returns the closest point of P to q. Some of our results assume that the data structure returns an exact nearest neighbor (NN) and others assume that the data structure returns a (1 + ε)-approximate nearest-neighbor (ANN). (See Section 2 for definitions.) In any probing scenario, it is necessary to begin with a general notion of the set's spatial location. We assume that P is contained within a given compact subset D of R d , called the domain.
The oracle is given as a black-box. Specifically, we do not allow deletions from or insertions into the data structure. We do not assume knowledge of the number of data points, nor do we make any continuity or smoothness assumptions. Indeed, most of our results apply to infinite point sets, including volumes or surfaces.

Prior Work and Applications
Implicitly-represented point sets arise in various applications. One example is that of analyzing a geometric shape through probing. An example of this is Atomic Force Microscopy (AFM) [Wik14]. This technology can reveal the undulations of a surface at the resolution of fractions of a nanometer. It relies on the principle that when an appropriately designed tip (the probe) is brought in the proximity of a surface to scan it, certain atomic forces minutely deflect the tip in the direction of the surface. Since the deflection of the tip is generally to the closest point on the surface, this mode of acquisition is an example of proximity probing. A sufficient number of such samples can be used to reconstruct the surface [BQG86].
The topic of shape analysis through probing has been well studied within the field of computational geometry. The most commonly assumed probe is a finger probe, which determines the first point of contact of a ray and the set. Cole and Yap [CY87] pioneered this area by analyzing the minimum number of finger probes needed to reconstruct a convex polygon. Since then, various alternative probing methods have been considered. For good surveys of this area, see Skiena [Ski89,Ski97].
More recently, Boissonnat et al. [BGO07] presented an algorithm for learning a smooth unknown surface S bounding an object O in R 3 through the use of finger probes. Under some reasonable assumptions, their algorithm computes a triangulated surface S that approximates S to a given level of accuracy. In contrast to our work, which applies to general point sets, all of these earlier results assume that the set in question is a connected shape or surface.
Implicitly-represented point sets also arise in geometric modeling. Complex geometric sets are often generated from much smaller representations. One example are fractals sets, which are often used to model natural phenomena such as plants, clouds, and terrains [SKG + 09]. Fractal objects are generated as the limit of an iterative process [Man83]. Due to their regular, recursive structure it is often possible to answer proximity queries about such a set without generating the set itself.
Two other examples of infinite sets generated implicitly from finite models include (1) subdivision surfaces [AS10], where a smooth surface is generated by applying a recursive refinement process to a finite set of boundary points, and (2) metaballs [Bli82], where a surface is defined by a blending function applied to a collection of geometric balls. In both cases, it is possible to answer nearest neighbor queries for the underlying object without the need to generate its boundary.
Proximity queries have been applied before. Panahi et al. [PASG13] use proximity probes on a convex polygon in the plane to reconstruct it exactly. Goel et al. [GIV01], reduce the approximation versions of several problems like diameter, farthest neighbors, discrete center, metric facility location, bottleneck matching and minimum weight matching to nearest neighbor queries. They sometimes require other primitives for their algorithms, for example computation of the minimum enclosing ball or a dynamic version of the approximate nearest-neighbor oracle. Similarly, the computation of the minimum spanning tree [HIM12] can be done using nearest-neighbor queries (but the data structure needs to support deletions). For more details, see the survey by Indyk [Ind04].

Our contributions
In this paper we consider a number of problems on implicitly-represented point sets. Here is a summary of our main results.
k-center clustering and the greedy permutation. Given a point set P, a greedy permutation (informally) is an ordering of the points of P: p 1 , . . . , p k , . . . , such that for any k, the set of points {p 1 , . . . , p k } is a O(1)-approximation to the optimal k-center clustering. This sequence arises in the k-center approximation of Gonzalez [Gon85], and its properties were analyzed by Har-Peled and Mendel [HM06]. Specifically, if P can be covered by k balls of radius r k , then the maximum distance of any point of P to its nearest neighbor in {p 1 , . . . , p k } is O(r k ).
In Section 3, we show that under reasonable assumptions, in constant dimension, one can compute such an approximate greedy permutation using O(k) exact proximity queries. If the oracle answers (1 + ε)-ANN queries, then for any k, the permutation generated is competitive with the optimal k-center clustering, considering the first O k log 1/ε Φ points in this permutation, where Φ is (roughly) the spread of the point set. The hidden constant factors grow exponentially in the dimension.
Approximate convex-hull membership. Given a point set P in R d , we consider the problem of deciding whether a given query point q ∈ R d is inside its convex-hull C = CH(P). We say that the answer is ε-approximately correct if the answer is correct whenever the query point's distance from the boundary of C is at least ε · diam(C). In Section 4, we show that, given an oracle for (1 + ε 2 /c)-ANN queries, for some sufficiently large constant c, it is possible to answer approximate convex-hull membership queries using O(1/ε 2 ) proximity queries. Remarkably, the number of queries is independent of the dimension of the data.
Our algorithm operates iteratively, by employing a gradient descent-like approach. It generates a sequence of points, all within the convex hull, that converges to the query point. Similar techniques have been used before, and are sometimes referred to as the Frank-Wolfe algorithm. Clarkson provides a survey and some new results of this type [Cla10]. A recent algorithm of this type is the work by Kalantari [Kal12]. Our main new contribution for the convex-hull membership problem is showing that the iterative algorithm can be applied to implicit point sets using nearest-neighbor queries.
Balanced proximity clustering. We study a problem that involves summarizing a point set in a way that preserves proximity information. Specifically, given a set P of n points in R d , and a parameter k, the objective is to select m centers from P, such that if we assign every point of P to its nearest center, no center has been selected by more than k points. This problem is related to topic of capacitated clustering from operations research [MB84].
In Section 5, we show that in the plane there exists such a clustering consisting of O(n/k) such centers, and that in higher dimensions one can select O((n/k) log(n/k)) centers (where the constant depends on the dimension). This result is not directly related to the other results in the paper.
Paper organization. In Section 2 we review some relevant work on k-center clustering. In Section 3 we provide our algorithm to compute an approximate k-center clustering. In Section 4 we show how we can decide approximately if a query point is within the convex hull of the given data points in a constant number of queries, where the constant depends on the degree of accuracy desired. Finally, in Section 5 we investigate balanced Voronoi partitions, which provides a density-based clustering of the data. Here we assume that all the data is known and the goal is to come up with a useful clustering that can help in proximity search queries.

Preliminaries
2.1. Background -k-center clustering and the greedy permutation The following is taken from [Har11,Chap. 4], and is provided here for the sake of completeness.
In the k-center clustering problem, a set P ⊆ R d of n points is provided together with a parameter k. The objective is to find a set of k points, C ⊆ P, such that the maximum distance of a point in P to its closest point in C is minimized. Formally, define price(C, P) = max p∈P min c∈C p − c . Let C opt denote the set of centers achieving this minimum. The k-center problem can be interpreted as the problem of computing the minimum radius, called the k-center clustering radius, such that it is possible to cover the points of P using k balls of this radius, each centered at one of the data points. It is known that k-center clustering is NP-Hard. Even in the plane, it is NP-Hard to approximate to within a factor of 1 + √ 7 /2 ≈ 1.82 [FG88].
The greedy clustering algorithm. Gonzalez [Gon85] provided a 2-approximation algorithm for kcenter clustering. This algorithm, denoted by GreedyKCenter, repeatedly picks the point farthest away from the current set of centers and adds it to this set. Specifically, it starts by picking an arbitrary point, c 1 , and setting C 1 = {c 1 }. For i > 1, in the ith iteration, the algorithm computes and the point c i that realizes it, where d(p, C i−1 ) = min c∈C i−1 p − c . Next, the algorithm adds c i to C i−1 to form the new set C i . This process is repeated until k points have been collected. If we run GreedyKCenter till it exhausts all the points of P (i.e., k = n), then this algorithm generates a permutation of P; that is, P = c 1 , . . . , c n . We will refer to P as the greedy permutation of P. There is also an associated sequence of radii r 1 , . . . , r n , and the key property of the greedy permutation is that for each i with 1 ≤ i ≤ n, all the points of P are within a distance at most r i from the points of C i = c 1 , . . . , c i . The greedy permutation has applications to packings, which we describe next.
Definition 2.1. A set S ⊆ P is an r-packing for P if the following two properties hold: (i) Covering property : All the points of P are within a distance at most r from the points of S.
(ii) Separation property : For any pair of points p, x ∈ S, p − x ≥ r. (For most purposes, one can relax the separation property by requiring that the points of S be at distance Ω(r) from each other.) Intuitively, an r-packing of a point set P is a compact representation of P at resolution r. Surprisingly, the greedy permutation of P provides us with such a representation for all resolutions.
Lemma 2.2 ( [Har11]). (A) Let P be a set of n points in R d , and let its greedy permutation be c 1 , . . . , c n with the associated sequence of radii r 1 , . . . , r n . For any i, C i = c 1 , . . . , c i is an r i -packing of P. Furthermore, r i is a 2-approximation for the optimal i-center clustering radius of P.
(B) For any k, let r k opt be the radius of the optimal k-center clustering of P. Then, for any constant c, r Computing the optimal k-center clustering of the first O(k/ε d ) points of the greedy permutation, after appropriate rescaling, results in a (1 + ε)-approximation to the optimal k-center clustering of P.

Setup
Our algorithms operate on a (not necessarily finite) point set P in R d . We assume that we are given a compact subset of R d , called the domain and denoted D, such that P ⊆ D. Throughout we assume that D is the unit hypercube [0, 1] d . The set P (not necessarily finite) is contained in D.
Given a query point q ∈ [0, 1] d , let nn(q, P) = arg min p∈P q − p denote the nearest neighbor (NN) of q. We say a point x is a (1 + ε)-approximate nearest-neighbor (ANN) for q if q − x ≤ (1 + ε) q − nn(q, P) . We assume that the sole access to P is through "black-box" data structures T nn and T ann , which given a query point q, return the NN and ANN, respectively, to q in P.

Using proximity search to compute k-center clustering
The problem. Our purpose is to compute (or approximately compute) a k-center clustering of P through the ANN black box we have, where k is a given parameter between 1 and n.

Greedy permutation via NN queries: GreedyPermutNN
Let q 0 be an arbitrary point in D. Let ν 0 be its nearest-neighbor in P computed using the provided NN data structure T nn . Let b 0 = ball(q 0 , q 0 − ν 0 ) be the open ball of radius q 0 − ν 0 centered at q 0 . Finally, let G 0 = {ν 0 }, and let D 0 = D \ b 0 .
In the ith iteration, for i > 0, let q i be the point in D i−1 farthest away from G i−1 . Formally, this is the point in D i−1 that maximizes d(q i , G i−1 ), where d(q, X) = min c∈X c − q . Let ν i = nn(q i , P) denote the nearest-neighbor ν i to q i in P, computed using T nn . Let Left to its own devices, this algorithm computes a sequence of not necessarily distinct points ν 0 , ν 1 , . . . of P. If P is not finite then this sequence may also have infinitely many distinct points. Furthermore, The execution of this algorithm is illustrated in Figure 3.1.

Analysis
Let O = {o 1 , . . . , o k } be an optimal set of k centers of P. Formally, it is a set of k points in P that minimizes the quantity r k opt = max q∈P d(q, O). Specifically, r k opt is the smallest possible radius such that k closed balls of that radius centered at points in P, cover P. Our claim is that after O(k) iterations of the algorithm GreedyPermutNN, the sequence of points provides a similar quality clustering of P.
For any given point p ∈ R d we can cover the sphere of directions centered at p by narrow cones of angular diameter at most π/12. We fix such a covering, denoting the set of cones by C p , and observe (1)  that the number of such cones is a constant c d that depends on the dimension. Moreover, by simple translation we can transfer such a covering to be centered at any point p ∈ R d .
Proof: If for any j ≤ µ, we have r j ≤ 3r opt then all the points of D j−1 ⊇ P are in distance at most 3r opt from G j , and the claim trivially holds as O ⊆ P.
Let o be an optimal center and let P o be the set of points of P that are closest to o among all the centers of O, i.e., P o is the cluster of o in the optimal clustering. Fix a cone φ from C o (φ's apex is at o). Consider the output sequence ν 0 , ν 1 , . . ., and the corresponding query sequence q 0 , q 1 , . . . computed by the algorithm. In the following, we use the property of the algorithm that r 1 ≥ r 2 ≥ · · · , where We proceed to show that there are at most O(1) admissible points for a fixed cone, which by a packing argument will imply the claim as every q j is admissible for exactly one cone. Consider the induced subsequence of the output sequence restricted to the admissible points of φ: ν 1 , ν 2 , . . ., and let q 1 , q 2 , . . . be the corresponding query points used by the algorithm. Formally, for a point ν i in this sequence, let iter(i) be the iteration of the algorithm it was created. Thus, for all i, we have q i = q iter(i) and ν i = ν iter(i) .
Observe that P o ⊆ P ∩ ball(o, r opt ). This implies that Let i = q i − ν i and r i = d q i , G iter(i)−1 . Observe that for i > 1, we have i ≤ r i ≤ i + 2r opt , as ν i−1 ∈ P o . Hence, if i ≤ r opt , then r i ≤ 3r opt , and we are done. This implies that for any i, j, such that 1 < i < j, it must be that q i − q j ≥ i > r opt , as the algorithm carves out a ball of radius i around q i , and q j must be outside this ball.
By a standard packing argument, there can be only O(1) points in the sequence q 2 , q 3 , . . . that are within distance at most 10r opt from o. If there are no points beyond this distance, we are done. Otherwise, let i > 1 be the minimum index, such that q i is at distance larger than 10r opt from o. We now prove that the points of φ \ ball(q i , i ) are of two types -those contained within ball(o, 3r opt ) and those that lie at distance greater than (4/3) i from o.
To see this, observe that since the angle of the cone was chosen to be sufficiently small, ball(q i , i ) splits φ into two components, where all the points in the component containing o are distance < 3r opt from o. The minimum distance to o (from a point in the component not containing o) is realized when q i is on the boundary of φ and o is on the boundary of ball(q i , i ). Then the distance of any point of φ \ ball(q i , i ) from o is at least 2 i cos(β) ≥ 2 i 3/4 ≥ 1.73 i , as the opening angle of the cone is at most π/12. See figure on the right. The general case is somewhat more complicated as o might be in distance at most r opt from the boundary of ball(q i , i ), but as i ≥ 10r opt , the claim still holds -we omit the tedious but straightforward calculations.
In particular, this implies that any later point q k in the sequence (i.e., k > i) is either one of the O(1) close points, or it must be far away, but then it is easy to argue that r k must be larger than r i , which is a contradiction as r 2 ≥ r 3 ≥ · · · (as r i appears before r k in this sequence).
The above lemma readily implies the following.
Theorem 3.2. Let P ⊆ D be a given set of points in R d (not necessarily finite), where D is a bounded set in R d . Furthermore, assume that P can be accessed only via a data structure T nn that answers exact nearest-neighbor (NN) queries on P. The algorithm GreedyPermutNN, described in Section 3.1, computes a permutation ν 0 , . . . of P, such that, for any k > 0, P ⊆ ck i= ball ν i , r k opt , where c is a constant (independent of k), and r k opt is the minimum radius of k balls (of the same radius) needed to cover P.
The algorithm can be implemented, such that running it for i iterations, takes polynomial time in i and involves i calls to T nn .
Proof: Using Lemma 2.2 (B) in Lemma 3.1 implies the result. As for the running time, naively one needs to maintain the arrangement of balls inside the domain, and this can be done in polynomial time in the number of balls.
Observation 3.3. If P is finite of size n, the above theorem implies that after i ≥ cn iterations, one can recover the entire point set P (as r n opt = 0). Therefore cn is an upper bound on the number of queries for any problem. Note however that in general our goal is to demonstrate when problems can be solved using a significantly smaller amount of NN queries.
The above also implies an algorithm for approximating the diameter.

Using approximate nearest-neighbor search
If we are using an ANN black box T ann to implement the algorithm, one can no longer scoop away the ball b i = ball(q i , q i − ν i ) at the ith iteration, as it might contain some of the points of P. Instead, one has to be more conservative, and use the ball b i = ball(q i , (1 − ε) q i − ν i ) Now, we might need to perform several queries till the volume being scooped away is equivalent to a single exact query. Specifically, let P be a finite set, and consider its associated spread : We can no longer claim, as in Lemma 3.1, that each cone would be visited only one time (or constant number of times). Instead, it is easy to verify that each query point in the cone, shrinks the diameter of the domain restricted to the cone by a factor of roughly ε. As such, at most O log 1/ε Φ = O(ε −1 log Φ) query points would be associated with each cone.
Corollary 3.5. Consider the setting of Theorem 3.2, with the modification that we use a (1 + ε)-ANN data structure T ann to access P. Then, for any k,

Discussion
Outer approximation. As implied by the algorithm description, one can think about the algorithm providing an outer approximation to the set: D 1 ⊇ D 2 ⊇ · · · ⊇ P. As demonstrated in Figure 3.1, the sequence of points computed by the algorithm seems to be a reasonable greedy permutation of the underlying set. However, the generated outer approximation seems to be inferior. If the purpose is to obtain a better outer approximation, a better strategy may be to pick the ith query point q i as the point inside D i farthest away from ∂D i−1 ∪ G i−1 Implementation details. We have not spent any effort to describe in detail the algorithm of Theorem 3.2, mainly because an implementation of the exact version seems quite challenging in practice. A more practical approach would be to describe the uncovered domain D i approximately, by approximating from the inside, every ball b i by an O 1/ε d grid of cubes, and maintaining these cubes using a (compressed) quadtree. This provides an explicit representation of the complement of the union of the approximate balls. Next, one would need to maintain for every free leaf of this quadtree, a list of points of G i that might serve as its nearest neighbors -in the spirit of approximate Voronoi diagrams [Har11].

Convex-hull membership queries via proximity queries
Let P be a set of n points in R d , let ∆ denote P's diameter, and let ε > 0 be a prespecified parameter. We assume that the value of ∆ is known, although a constant approximation to this value is sufficient for our purposes. (See Lemma 3.4 on how to compute this under reasonable assumptions.) Let C = CH(P) denote P's convex hull. Given a query point q ∈ R d , the task at hand is to decide if q is in C. As before, we assume that our only access to P is via an ANN data structure. There are two possible outputs: (A) In: if q ∈ C, and (B) Out: if q is at distance greater than ε∆ from C, Either answer is acceptable if q lies within distance ε∆ of ∂C.

Convex hull membership queries using exact extremal queries
We first solve the problem using exact extremal queries and then later show these queries can be answered approximately with ANN queries.

The algorithm
We construct a sequence of points p 0 , p 1 , . . . each guaranteed to be in the convex hull C of P and use them to determine whether q ∈ C. The algorithm is as follows. Let p 0 be an arbitrary point of P. For i > 0, in the ith iteration, the algorithm checks whether p i−1 − q ≤ ε∆, and if so the algorithm outputs In and stops.
Otherwise, consider the ray ψ i emanating from p i−1 in the direction of q. The algorithm computes the point z i ∈ P that is extremal in the direction of this ray. If the projection z i of z i on the line supporting ψ i is between p i−1 and q, then q is outside the convex-hull C, and the algorithm stops and returns Out. Otherwise, the algorithm sets p i to be the projection of q on the line segment p i−1 z i , and continues to the next iteration. See figure on the right, and Figure 4.1.
The algorithm performs O(1/ε 2 ) iterations, and returns Out if it did not stop earlier.

Analysis
Lemma 4.1. If the algorithm runs for more than i iterations, then Proof: By construction, p i , p i−1 , and q form a right angle triangle. The proof now follows by a direct trigonometric argument. Consider Figure 4.1. We have the following properties: We conclude that cos β = Lemma 4.2. Either the algorithm stops within O(1/ε 2 ) iterations with a correct answer, or the query point is more than ε∆ far from the convex hull C; in the latter case, since the algorithm says Out its output is correct.
Proof: If the algorithm stops before it completes the maximum number of iterations, it can be verified that the output is correct as there is an easy certificate for this in each of the possible cases. Otherwise, suppose that the query point is within ε∆ of C. We argue that this leads to a contradiction; thus the query point must be more than ε∆ far from C and the output of the algorithm is correct. Observe that d i is a monotone decreasing quantity that starts at values ≤ ∆ (i.e, d 0 ≤ ∆), since otherwise the algorithm terminates after the first iteration, as z 1 would be between q and p 0 on ψ 1 .
Consider the jth epoch to be block of iterations of the algorithm, where 2 −j ∆ < d i ≤ 2 −j+1 ∆. Following the proof of Lemma 4.1, one observes that during the jth epoch one can set ε j = 1/2 j in place of ε, and using the argument it is easy to show that the jth epoch lasts O(1/ε 2 j ) iterations. By assumption, since the algorithm continued for the maximum number of iterations we have d i > ε∆, and so the maximum number of epochs is lg(1/ε) . As such, the total number of iterations is O(1/ε 2 j ) = O(1/ε 2 ). Since the algorithm did not stop this is a contradiction.

Approximate extremal queries
For our purposes, approximate extremal queries on P are sufficient.
Definition 4.3. A data structure provides ε-approximate extremal queries for P, if for any query unit vector v, it returns a point p, such that where v, x denotes the dot-product of v with x. One can now modify the algorithm of Section 4.1.1 to use, say, ε/4-approximate extremal queries on P. Indeed, one modifies the algorithm so it stops only if z i is on the segment p i−1 q, and it is in distance more than ε∆/4 away from q. Otherwise the algorithm continues. It is straightforward but tedious to prove that the same algorithm performs asymptotically the same number of iterations (intuitively, all that happens is that the constants get slightly worse). The worse case as far progress in a single iteration is depicted in Figure 4.2.
Lemma 4.4. The algorithm of Section 4.1.1 can be modified to use ε/4-approximate extremal queries and output a correct answer after performing O(1/ε 2 ) iterations.

Convex-hull membership via ANN queries 4.2.1. Approximate extremal queries via ANN queries
The basic idea is to replace the extremal empty half-space query, by an ANN query. Specifically, a (1 + δ)-ANN query performed at q returns us a point p, such that Namely, ball q, q−p 1+δ does not contain any points of P. Locally, a ball looks like a halfspace, and so by taking the query point to be sufficiently far and the approximation parameter to be sufficiently small, the resulting empty ball and its associated ANN can be used as the answer to an extremal direction query.

The modified algorithm
Assume the algorithm is given a data structure T ann that can answer (1 + δ)-ANN queries on P. Also assume that it is provided with an initial point p 0 ∈ P, and a value ∆ that is, say, a 2-approximation to ∆ = diam(P), that is ∆ ≤ ∆ ≤ 2∆.
In the ith iteration, the algorithm considers (again) the ray ψ i starting from p i , in the direction of q. Let q i be the point within distance, say, τ = c∆ /ε (4.1) from p i−1 along ψ i , where c is an appropriate constant to be determined shortly. Next, let z i be the (1 + δ)-ANN returned by T ann for the query point q i , where the value of δ would be specified shortly.
The algorithm now continues as before, by setting p i to be the nearest point on p i−1 z i to q. Naturally, if q − p i falls below ε∆ /2, the algorithm stops, and returns In, and otherwise the algorithm continues to the next iteration. As before, if the algorithm reaches the N th iteration, it stops and returns Out, where N = O(1/ε 2 ). Figure 4.3: Illustration of the proof of Lemma 4.5.
Proof: Consider the extreme point y i ∈ P in the direction of ψ i . Let y i be the projection of y i to the segment p i−1 q i , and let = q i − y i . See Figure 4.3.
The (1 + δ)-ANN to q i (i.e., the point z i ), must be inside the ball b = ball(q i , (1 + δ) ), and let z i be its projection to the segment p i−1 q i . Now, if we interpret z i as the returned answer for the approximate extremal query, then the error is the distance z i − y i , which is maximized if z i is as close to p i−1 as possible. In particular, let u be the point in distance (1 + δ) from q i along the segment p i−1 q i . We then have that A similar argument implies that ≥ τ − ∆. In particular, it is enough to satisfy the constraint Substituting the value of τ = c∆ /ε, see Eq. (4.1), this is equivalent to 1 c/ε−1 2 ≤ δ ≤ ε/2 4(c/ε+1) , which holds for c = 32, as can be easily verified, and setting δ = ε 2 /(32 − ε) 2 = O(ε 2 ).
Theorem 4.6. Given a set P of n points in R d , let ε ∈ (0, 1] be a parameter, and let ∆ be a constant approximation to the diameter of P. Assume that you are given a data structure that can answer (1 + δ)-ANN queries on P, for δ = O(ε 2 ). Then, given a query point q, one can decide, by performing O(1/ε 2 ) (1 + δ)-ANN queries whether q is inside the convex-hull C = CH(P). Specifically, the algorithm returns • In: if q ∈ C, and • Out: if q is more than ε∆ away from C, where ∆ = diam(P). The algorithm is allowed to return either answer if q / ∈ C, but the distance of q from C is at most ε∆.

Definition
Given a set P of n points in R d , and a parameter k with 1 ≤ k ≤ n, we are interested in computing a set C ⊆ P of "centers", such that each center is assigned at most k points, and the number of centers is (roughly) n/k. In addition, we require that: (A) A point of P is assigned to its nearest neighbor in C (i.e., C induces a Voronoi partition of P). (B) The centers come from the original point set. Intuitively, this clustering tries to capture the local density -in areas where the density is low, the clusters can be quite large (in the volume they occupy), but in regions with high density the clusters have to be tight and relatively "small".
Formally, given a set of centers C, and a center c ∈ C, its cluster is where d(c, X) = min p∈X c − p (and assuming for the sake of simplicity of exposition that all distances are distinct). The resulting clustering is Π(P, C) = {P c | c ∈ C }. A set of points P, and a set of centers C ⊆ P is a k-density clustering of P if for any c ∈ C, we have |P c | ≤ k. As mentioned, we want to compute a balanced partitioning, i.e., one where the number of centers is roughly n/k. We show below that this is not always possible in high enough dimensions.

A counterexample in high dimension
Lemma 5.1. For any integer n > 0, there exists a set P of n points in R n , such that for any k < n, a k-density clustering of P must use at least n − k + 1 centers.
Proof: Let n be a parameter. For i = 1, . . . , n, let i = √ 1 − 2 −i−1 , and let p i be a point of R n that has zero in all coordinates except he ith one, where its value is i . Let P = {p 1 , . . . , p n } ⊆ R n . Now, That is, the distance of the ith point to all the following points S i+1 = {p i+1 , . . . , p n } is smaller than the distance between any pair of points of S i+1 . Now, consider any set of centers C ⊆ P, and let c = p i be the point with the lowest index that belongs to C. Clearly, P c = (P \ C) ∪ {c}; that is, all the non-center points of P, get assigned by the clustering to c, implying what we want to show.

Algorithms
5.2.1. Density clustering via nets Lemma 5.2. For any set of n points P in R d , and a parameter k < n, there exists a k-density clustering with O n k log n k centers (the O notation hides constants that depend on d). Proof: Consider the hypercube [−1, 1] d . Cover its outer faces (which are (d−1)-dimensional hypercubes) by a grid of side length 1/3 √ d. Consider a cell C in this grid -it has diameter ≤ 1/3, and it is easy to verify that the cone φ C = {tp | p ∈ C, t ≥ 0} formed by the origin and C has angular diameter < π/3. This results in a set C of N = O(d d ) cones covering R d .
Furthermore, the cone φ C is formed by the intersection of 2(d − 1) halfspaces. As such, the range space consisting of all translations of φ C has VC dimension at most d = O(d 2 log d) [Har11,Theorem 5.22]. Let slice be the set that is formed by the intersection of such a cone, with a ball centered at its apex. The range space of such slices has VC dimension d = O(d + 2 + d ) = O(d 2 log d), since the VC dimension of balls in R d is d + 2, and one can combine the range spaces as done above, see the book [Har11] for background on this. Now, for ε = (k/N )/n, consider an ε-net R of the point set P for slices. The size of such a net is |R| = O((d /ε) log ε −1 ) = d O(d) (n/k) log(n/k).
Consider a point p ∈ P that is in R, and consider the cones of C translated so that their apex is p. For a cone φ ∈ C, let ν φ be the nearest point to p in the set R \ {p} ∩ φ. The key observation is that any point in P ∩ φ that is farther away from p than ν φ , is closer to ν φ than to p; that is, only points closer to p than ν φ might be assigned to p in the Voronoi clustering. Since R is an ε-net for slices, the slice ball p, p − ν φ ∩ φ contains at most εn = k/N points of P. It follows that at most k/N points of P ∩ φ are assigned to the cluster associated with p. By summing over all N cones, at most (k/N )N = k points are assigned to p, as desired.

The planar case
Lemma 5.3. For any set of n points P in R 2 , and a parameter k with 1 ≤ k ≤ n, there exists a k-density clustering with O(n/k) centers.
Proof: Consider the plane, and a cone φ ∈ C as used in the proof of Lemma 5.2. For a point p ∈ R 2 , and a radius r, let φ p denote the translated cone having p as an apex, and let s(p, r) = φ p ∩ ball(p, r) be a slice induced by this cone. Consider the set of all possible slices in the plane: S = s(p, r) p ∈ R 2 , r ≥ 0 .
It is easy to verify that the family S behaves like a system of pseudo-disks; that is, the boundary of a pair of such regions intersects in at most two points, see figure on the right. As such, the range space having P as the ground set, and S as the set of possible ranges, has an ε-net of size O(1/ε) [MSW90]. Let ε = (k/N )/n, as in the proof of Lemma 5.2, where N = |C|. Computing such an ε-net, for every cone of C, and taking their union results in the desired set of cluster centers.