Abstract 1 Introduction 2 Top-Open Skyline Counting 3 Adjusted Right Boundary 4 Bottom-open Three-sided Queries 5 Top-Open Skyline Color Counting 6 Top-Open Skyline Color Reporting 7 Conclusion References Appendix A Proofs of Lemmas 15 and 16

New Results on Three-Sided Skyline Range Counting and Reporting

Suruchi Kushwaha ORCID Michigan Technological University, Houghton, MI, USA    Yakov Nekrich ORCID Michigan Technological University, Houghton, MI, USA
Abstract

In the orthogonal skyline range counting (resp. reporting) problem we store the set of points P in a data structure so that for any query range Q the number of points (resp. the list of all points) on the skyline of QP can be found efficiently. In this paper we study two-dimensional range counting and reporting problems in the case when the query range is bounded on three sides.

We describe a linear-space data structure that answers top-open three-sided skyline counting queries in O(loglogN) time, where N is the number of points stored in the data structure. We also show that bottom-open three-sided skyline counting queries are as difficult as general four-sided queries and any data structure that uses O(NlogcN) space for a constant c requires Ω(logN/loglogN) time to answer such queries.

Next, we turn to skyline color range queries. In this variant of the problem each point in P is assigned a color and we must count (resp. report) the distinct colors of point on the skyline of QP. We describe an O(N)-space data structure that answers top-open three-sided color counting queries in O(logN/loglogN) time. Finally, we study top-open three-sided skyline color reporting in the EM model and describe a data structure that uses linear space and answers queries in O(kB+1) I/Os where k is the number of colors on the skyline. This is the first external-memory data structure with optimal query cost and space usage for this problem.

Keywords and phrases:
Data Structures, Range Searching, Skyline Queries
Copyright and License:
[Uncaptioned image] © Suruchi Kushwaha and Yakov Nekrich; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Data structures design and analysis
Editor:
Pierre Fraigniaud

1 Introduction

A two-dimensional point p=(p.x,p.y) is said to be dominated by a point q=(q.x,q.y) if q.x>p.x and q.yp.y, or q.xp.x and q.y>p.y. For a set of points P, the skyline of P is the subset of points that are not dominated by any other point in P. A skyline range searching query Q on a set of points P asks for (some information) about the skyline of points in PQ.

In this paper we study different variants of two-dimensional skyline range searching in the case when the query range is bounded on three sides. See Figure 1. We present new results for three-sided skyline range counting queries and three-sided skyline color range counting queries. We also describe a data structure for three-sided skyline color range reporting in the external memory model.

Previous Work

A skyline range counting query Q asks for the number of points on the skyline of QP. Orthogonal skyline range counting queries were considered in [10, 6, 3]. Brodal and Larsen [3] described a O(N)-space data structure with O(logN/loglogN) query time for a four-sided range. In [3] the authors also showed that this bound is tight: any data structure that uses NlogO(1)N space supports skyline range counting queries in Ω(logN/loglogN) time.

A skyline range reporting query Q asks for the list of all points on the skyline of PQ. Data structures for orthogonal skyline range reporting queries were studied in [5, 3, 11, 9]. Das et al. [5] presented a data structure that uses O(NlogN/loglogN) space and supports four-sided skyline range reporting queries in O(logN/loglogN+k) time, where k is the number of reported skyline points. Brodal and Larsen [3] imporved their result and described a data structure that requires query time O(logN/loglogN+k) and space usage O(NlogεN).

In the external memory model [17], Kejlberg-Rasmussen et al. [11] present a linear space data structure that answers four-sided skyline reporting queries in O((N/B)ε+k/B) I/Os, where k is the number of reported points and B is the block size. In the same paper [11] the authors present a linear-space data structure that answers top-open three-sided skyline reporting queries in O(1+k/B) I/Os when all points are on N×N grid.

Ganguly et al. [9] studied the colored version of skyline range reporting problem in the external-memory model. In this variant of the problem each point is assigned a color (or category). The answer to a query Q is the list of colors that occur on the skyline of PQ. For the case when all points are on the N×N grid, Ganguly et al. [9] describe a data structure that uses O(NlogN) space and answers top-open three-sided queries in O(1+k/B) I/Os and a data structure that uses O(N) space and answers queries in O((logN)2+k/B) I/Os, where k is the number of reported colors.

Our Results

In this paper we describe a linear-space data structure that answers top-open three-sided skyline range counting queries on N×N grid in time O(loglogN). We also show that any data structure with O(NlogcN) space for some constant c>0 needs Ω(logN/loglogN) time to answer bottom-open three-sided skyline range counting queries. This result demonstrates that there is a fundamental gap between top-open queries (i.e., when the query range is unbounded in +y direction) and bottom-open queries (i.e., when the query range is unbounded in y direction) with respect to skyline counting queries. Moreover, due to the lower bound on orthogonal range counting [16], we need Ω(logN/loglogN) time to answer two-dimensional range counting queries using O(Npolylog(N)) space. This lower bound is also valid when the query range is a top-open three-sided range. Our result thus shows that counting points on a skyline of a query range can be fundamentally faster than counting all points in a query range.

Next we turn to the skyline color range counting problem. We describe a data structure that answers top-open three-sided skyline color counting queries in O(logN/loglogN) time. That is, our data structure calculates, for any top-open three-sided query range Q, the number of distinct colors of points on the skyline of Q. This is the first data structure for the skyline color counting problem.

Finally we consider top-open three-sided color range reporting in the external-memory model. We improve upon the previous result by Ganguly et al. [9] and describe a data structure that uses O(N) space and supports queries in O(kB+1) I/Os, where k is the number of reported colors and B is the block size. Our result demonstrates that three-sided skyline color reporting can be implemented with optimal space and query cost. For comparison, the best currently known solution for the three-sided color reporting problem (i.e., for the case when all colors in a three-sided query range must be reported) either uses super-linear space or has super-constant query cost [15]. Thus our result shows that skyline reporting can be more efficient than general color reporting in the case of top-open three-sided ranges (with respect to the best currently known results).

Figure 1: Examples of four-sided (left) top-open three-sided (center) and bottom-open three-sided (right) skyline queries.

For simplicity we will assume throughout this paper that point coordinates are in the rank space [8, 1], i.e., all point coordinates are distinct integers from { 1,,N}. We reserve N to denote the total number of points in a data structure and B will denote the block size in the external memory model.

2 Top-Open Skyline Counting

In this section we describe a simple linear-space data structure that answers three-sided skyline counting queries in O(loglogN) time. Our solution uses the sweepline technique: a vertical sweepline l is moved in +x direction and a subset of points to the left of l is stored in a partially persistent list L. When a point p is hit by the sweepline, the list L is updated as follows: we remove all points pL with p.yp.y; then we add p to L. Points in L are stored in decreasing order of their y-coordinates. We will denote by L(a) the version of L after removing all p and inserting the point p with p.x=a. See Figure 2 for an example.

(a) Example skyline points.
(b) Example skyline points in partially persistent list.
Figure 2: Skyline points in our data structure.
Lemma 1.

When the vertical sweepline hits a point p, p is appended at the end of L.

Proof.

Follows directly from the description. When a point p is inserted into L, all points p with p.y<p.y must be removed from L. The rank of a point p in the list L, denoted by rank(p), is equal to the number of points that precede p in L (plus one). By Lemma 1, when a point p is inserted into L(p.x), the rank of p equals the size of L(p.x); the rank of any point p is not changed while p is in L.

Lemma 2.

A point p is in L(a) iff p is on the the skyline of Qa=(,a]×(,+).

Proof.

If p is not on the skyline of Qa, then p is dominated by some point pQa. Since p.x<p.xa and p.yp.y, p was removed from L(a) for some ap.xa and pL(a).
If p is on the skyline of Qa, then there is no point p′′ such that p.xp′′.xa and p.yp′′.y. By definition of L, pL(a). If a point p precedes a point q in L, we will denote this by pq.

Lemma 3.

If pq in L, then p.x<q.x and p.y>q.y.

Proof.

Consider the version L(q.x) of L.
By Lemma 1, q is appended at the end of L(q.x) and p precedes q in L(q.x); since L is sorted by y-coordinates, p.y>q.y. By Lemma 2, p and q are on the skyline of (,a]×(,+). Since p.yq.y and p does not dominate q, p.x<q.x.

Lemma 4.

A point p is on the skyline of Q=[a,b]×[c,+) iff p is on the skyline of (,b]×(,+), p.xa and p.yc.

Proof.

Consider a point p on the skyline of [a,b]×[c,+). Then p.xa and p.yc. There is no point p[a,b]×[c,+) that dominates p. Any point p that dominates p must satisfy p.xa and p.yc. Hence, there is no point in (,b]×(,+) that dominates p. Conversely, consider a point p on the skyline of (,b]×(,+) such that p.xa and p.yc. There is no point p that dominates p in the region (,b]×(,+). Hence there is no point p that dominates p in [a,b]×[c,+). Since p is in Q and p is not dominated by any other pQ, p is on the skyline of Q.

Theorem 5.

There exists an O(N)-space data structure that answers top-open three-sided skyline counting queries on N×N grid in time O(loglogN).

Proof.

We use the partially persistent predecessor data structure by Chan [4] that supports queries in O(loglogN) time and uses O(N) space where N is the total number of elements stored in the data structure. We employ two instances of Chan’s data structure, one that supports queries on x-coordinates of points in L and one that supports queries on y-coordinates of points in L. Suppose that we must answer a skyline counting query on a range Q=[a,b]×[c,+). By Lemmas 2 and 4, a point p is on the skyline of [a,b]×[c,+) iff pL(b), p.xa and p.yb. Points in L(b) are sorted in increasing order by their x-coordinates and in decreasing order by their y-coordinates. Let pc denote the point in L(b) with the smallest y-coordinate such that pc.yc. Let pa denote the point in L(b) with the largest x-coordinate such that pc.xa. By Lemma 3, the skyline of Q consists of all points p in L(b) such that pappc. The number of such points is rank(pc)rank(pa)+1, where rank(q) denotes the rank of a point q in L. Using the reduction to rank space technique, we can extend the result of Theorem 5 to the general case of N points on a U×U grid; see e.g., [1]. In this general case, the space usage of the data structure remains O(N) and the query time is increased by an additive term qpred(N)=O(min(logN/loglogN,loglogU)), where qpred(N) is the time needed to answer a predecessor query [13].

3 Adjusted Right Boundary

For a given set of points P and query range Q the range predecessor of PQ is the point ps with the largest x-coordinate in PQ. The adjusted right boundary of PQ, denoted by 𝚊𝚍𝚓(P,Q), is the x-coordinate of ps. Thus 𝚊𝚍𝚓(P,Q) is the x-coordinate of the rightmost point in PQ. For simplicity we will denote 𝚊𝚍𝚓(P,Q) as 𝚊𝚍𝚓(Q), since P is the entire input set. Using the adjusted right boundary, we can convert a skyline query on a top-open three-sided range Q=[a,b]×[c,+) into a skyline query on an one-dimensional range Q=[a,b]×(,+) where b=𝚊𝚍𝚓(Q). We will use the partially persistent list L, introduced in Section 2 to describe our result in this section.

Figure 3: An example of adjusted right boundary; b=𝚊𝚍𝚓(Q) for Q=[a,b]×[c,+).
Lemma 6.

A point p is on the skyline of Q=[a,b]×[c,+) iff p is on the skyline of Q=[a,b]×(,+) where b=𝚊𝚍𝚓(Q).

Proof.

Suppose that a point p is on the skyline of Q, i.e there is no other point qQ that dominates p. By definition of 𝚊𝚍𝚓(Q), b is the largest x-coordinate of a point in Q. Hence, p.xb and therefore p must be in Q. There is no point in [a,b]×[c,+) that dominates p because [a,b]×[c,+)[a,b]×(,+) and there is no point with y-coordinate less than c that dominates p because p.yc. Therefore, p is on the skyline of Q. Now, suppose the point p is on the skyline of Q. Since p.xb and bb, p.xb. Let pr be the point such that b=pr.x. Then pr is the point with the largest x-coordinate in Q and pr.yc. Since p.xpr.x and p is on the skyline of Q, p.ypr.yc. There is also no point q with q.x[b,b] and q.yc. Therefore pQ and is also on the skyline of Q.

The following lemma enables us to compute the range predecessor query in a top-open three-sided range.

Lemma 7.

Let Q=[a,b]×[c,+) and let pc denote the point that is the successor of c in L(b) with respect to y-coordinates. If Q is not empty, then pc is the range predecessor of Q.

Proof.

According to Lemma 2, L(b) is the skyline of points in (,b]×(,+), hence pc.xb. Since, pc is the successor of c in L(b) with respect to y-coordinates, pc.yc and by Lemma 3, pc.x must be the point with largest x-coordinate in L(b) among the points that have y-coordinate greater than c. Therefore, pc is the point with largest x-coordinate in the range (,b]×[c,+). Since Q is not empty, pc.xa. Hence, pcQ and is also the range predecessor of Q.

To find the adjusted right boundary of a top-open three-sided query range Q=[a,b]×[c,+), we visit the version L(b) of the partially persistent list, i.e. the version that is created when the vertical sweepline hits x=b. By Lemma 7, we can find the adjusted right boundary in O(loglogN) time using the persistent predecessor data structure from [4].

4 Bottom-open Three-sided Queries

In this section we show that a four-sided skyline range searching query Q=[a,b]×[c,d] can be reduced to a bottom-open three-sided skyline range searching query Q=[a,b]×(,d] where b is the x-coordinate of the rightmost point in Q (aka the range predecessor of Q). In other words the skyline of Q is the same as the skyline of the bottom-open range Q=[a,b]×(,d], where b=ps.x.

Figure 4: Reduction of a four-sided skyline query to a bottom-open three-sided skyline query.
Lemma 8.

Let ps denote the rightmost point in a four-sided range Q=[a,b]×[c,d]. A point p is on the skyline of Q iff p is on the skyline of Q=[a,b]×(,d] where b=ps.x.

Proof.

Consider some point p on the skyline of Q. Since ps is the rightmost point in Q, p.xps.x and hence p is in Q. Since p is on the skyline of Q and bb there is no point in [a,b]×[c,d] that dominates p. No point in [a,b]×(,c] can dominate p because p.yc. Hence, no point in Q dominates p and p is on the skyline of Q. Now, suppose a point p is on the skyline of Q. Since b=ps.x, p.xps.x. The point p is not dominated by ps because p is on the skyline of Q and hence p.yps.yc since ps is the rightmost point of Q. This implies that pQ and, since [b,b]×[c,d] is empty, p is also on the skyline of Q.

We can use any data structure for bottom-open three-sided skyline queries to answer four-sided skyline queries, with an additional cost of finding the rightmost point in the four-sided range. Through this reduction, we can demonstrate that solving a bottom-open three-sided skyline query is as hard as solving a four-sided skyline query.

Theorem 9.

If we can answer a bottom-open three-sided skyline counting query in time O(Q(N)) and O(S(N)) space, then we can answer a four-sided skyline counting query in time O(Q(N)+Q(N)) and O(S(N)+S(N)) space where Q(N) and S(N) are the time and space required for answering a range predecessor query.

Using the result of Nekrich and Navarro [14], the range predecessor query can be answered in O(N) space and O(logεN) time. Hence we can set S(N)=O(N) and Q(N)=O(logεN) in Theorem 9. As a direct corollary of this result, we establish the lower bound of Ω(logN/loglogN) for bottom-open three-sided skyline counting queries. This lower bound is also valid when all points are on N×N grid.

Corollary 10.

Any data structure that uses O(Npolylog(N)) space needs Ω(logN/loglogN) time to answer a bottom-open three-sided skyline counting query.

Proof.

In [3], Brodal and Larsen prove the Ω(logN/loglogN) lower bound for four-sided skyline counting queries. By Theorem 9 and [14], a data structure that supports three-sided bottom-open queries in O(S(N)) space and O(Q(N)) time can be used to answer four-sided queries in O(S(N)+N) space and O(Q(N)+logεN) time. Hence, the lower bound of Brodal and Larsen [3] is also valid for bottom-open three-sided queries. We remark that Corollary 10 is valid even if points are in the rank space. On the other hand, we have shown in Theorem 5 that top-open three-sided skyline counting queries can be answered in O(loglogN) time using linear space. Theorem 5 and Corollary 10 show that there is a significant complexity gap between the top-open and bottom-open variants of three-sided skyline counting.

5 Top-Open Skyline Color Counting

In this section, we present a linear space data structure for skyline color counting queries on a top-open three-sided range in O(logN/loglogN) time. We use the adjusted right boundary, defined in Section 3, to reduce a top-open three-sided query to a two-sided query; then we count the distinct colors on the skyline of a two-sided range. The data structure will use the persistent list approach, similar to Section 2. But now our task is more challenging because distinct colors of points on the skyline must be counted and there could be several points of the same color. Therefore we will employ a different persistent list and combine this approach with the reduction of three-sided to two-sided queries from Section 3.

Let L denote the partially persistent list that was defined in Section 2 and let Lc be the sub-list of the partially persistent list L where for every version k and each color α that occurs in L(k), Lc(k) stores the bottommost point of color α from L(k). Thus, as the vertical sweepline l moves along +x direction, we keep only the bottommost point of each distinct color on the skyline to the left of l in the partially persistent list Lc. Our definition of the sublist is motivated by the fact that we must count the number of distinct colors on the skyline. Thus, Lc must contain exactly one point for every color on the skyline of the respective two-sided range. The correctness of our method will be proved in Lemma 11, 12, and 13.

We distinguish between three different kinds of updates on Lc. When l hits a point p with p.x=a, we erase all points pLc such that p.yp.y. An erased point p is permanently deleted from Lc as it will no longer be on the skyline; that is, p will not be reinserted into any later versions of the list Lc. When a point p is erased, we reinsert the bottommost previously removed point pr such that pr.color=p.color and pr.y>p.y (provided such point pr exists). If there is a point qLc such that q.color=p.color and q.y>p.y, we remove q. A removed point q is still on the skyline but is not the bottommost point of its color. Hence it must be deleted from the current version of Lc, but it can be reinserted into a later version of Lc. Then we add p to Lc. We will denote by Lc(a) the version of Lc after erasing all p, removing q, and inserting p.

(a) Example color skyline points.
(b) Example color skyline points in partially persistent list.
Figure 5: Color skyline points in our data structure.
Lemma 11.

There is at least one point of color α on the skyline of Q=(,b]×(,) iff there is exactly one point of color α in Lc(b).

Proof.

Suppose there is one or more points p1,p2,p3,,pt where t1 of color α on the skyline of Q. Then by Lemma 2, p1,p2,p3,,ptL(b) and by definition the bottommost point is in Lc(b). Therefore Lc(b) contains exactly one point of color α. Conversely, let pα be the point of color α in Lc(b). Then pα is also in L(b) because Lc(b)L(b). Hence, by Lemma 2, pα is on the skyline of the query range Q and there is at least one point of color α in Q.

Lemma 12.

There is at least one point of color α on the skyline of Q=[a,b]×(,+) iff there is exactly one point pLc(b) such that p.xa.

Proof.

Suppose there are one or more points p1,p2,p3,,pt where t1 of color α on the skyline of Q. Then by Lemma 2, p1,p2,p3,,ptL(b). Let pb denote the bottommost point of color α in L(b). Since pbQ, pb.xa. By definition, only pbLc(b). Therefore, Lc(b) contains exactly one point of color α such that p.xa. Conversely, consider the point pLc(b) with p.xa. Then by definition, pL(b) and by Lemma 2, p is on the skyline of (,b]×(,+). Finally, using a special case of Lemma 4, where c=, p is on the skyline of Q.

Lemma 13.

There is at least one point of color α on the skyline of Q=[a,b]×[c,+) iff there is exactly one point p of color α in Lc(b) such that p.xa and b=𝚊𝚍𝚓(Q).

Proof.

Suppose there is at least one point p of color α on the skyline of Q. By Lemma 6, pb is on the skyline of [a,b]×(,+) where b=𝚊𝚍𝚓(Q). Hence by Lemma 13, there is exactly one point of color α in Lc(b). Conversely, suppose the point p of color α is in Lc(b). By Lemma 11, p is on the skyline of (,b)×(,+). Given that p.xa, hence by Lemma 6, p is on the skyline of Q.

We can count the number of points rLc(b) with r.xa and b=𝚊𝚍𝚓(Q) by answering a partially persistent range counting query. We use the data structure of Munro et. al. [12] that answers such queries in O(logm/loglogm) time and uses O(m) space, where m is the total number of updates in Lc. We will show below that m=O(N). Thus we can count the number of points rLc(b) with r.xa in O(logm/loglogm)=O(logN/loglogN) time and the total query time is O(logN/loglogN).

Space Usage

To demonstrate that the space requirement for the data structure is O(N), we need to evaluate the number of updates for Lc. Suppose that every update costs $1 and each point is initially assigned $4 before being inserted into the partially persistent list. We will show below that this overall budget of $4N is sufficient to execute all necessary updates of Lc. The insert operation costs $1, leaving the point with $3. At any time, a point pLc can be either removed or erased from the list. When p is removed, $1 is spent; thus each removed point has $2. A removed point p is reinserted into Lc only when a point po with the same color and smaller y-coordinate is erased from Lc. The erased point, with $3, spends $1 on the erase operation; the remaining $2 are transferred from po to the reinserted point p. Thus p spends $1 on an insertion and receives $2 from po. Hence when a point is re-inserted into pb, it has a budget of $3. In summary, the list Lc is updated m4N times. Since the total number of updates is m=O(N), the space used by Lc and the range counting data structure is also bounded by O(N).

Theorem 14.

There exists an O(N)-space data structure that answers top-open three-sided skyline color counting queries in O(logN/loglogN) time.

6 Top-Open Skyline Color Reporting

In this section we describe an external memory data structure that uses linear space and supports top-open three-sided skyline color reporting queries in O(kB)+1 I/Os, where k is the number of reported colors. Our data structure uses the persistent list Lc defined in Section 5. By Lemma 12, a color occurs on the skyline of Q=[a,b]×[c,+) iff there is a point p of that color in Lc(b), such that p.xa and b is the adjusted right boundary of Q. Thus, a query can be answered by accessing the version Lc(b) of Lc. However, it is not clear whether we can compute the adjusted right boundary in O(1) time. In this paper we use a different approach that relies on the results from previous sections. We will show that we can either (1) calculate b in O(kB) I/Os when the number of colors k is sufficiently large or (2) calculate the adjusted right boundary in O(1) time for an appropriately selected small subset of points.

The following two lemmas will be used in this section.

Lemma 15.

Let S be a set of integers such that |S|=O(Blog2N). There exists a data structure that uses space O(|S|) and supports predecessor queries on S in O(1) I/Os.

Lemma 16.

Let P be a set of two-dimensional points such that |P|=O(Blog2N). There exists a data structure that uses space O(|P|) and answers range predecessor queries on P in O(1) I/Os.

Both lemmas can be easily proved by combining standard data structures; for completeness, we provide a proof in Appendix.

Data Structure

We divide the points into chunks of size Δ=Blog2N according to their x-coordinates. Thus, the i-th chunk contains points p, such that iΔ<p.x(i+1)Δ and the total number of chunks is NΔ. Each chunk is stored in the data structure of Lemma 16.

Chunks are also grouped into a number of (intersecting) sets, further called canonical sets. For every i such that 1i<NΔ and for every j such that (i+2j)ΔN, the canonical set Ii,j consists of all points with x-coordinates in [iΔ+1,(i+2j)Δ]. For each canonical set I, we store the list TS(I) that contains BlogN topmost points with distinct colors that occur on the skyline of I. More formally: Let V(I) denote the (conceptual) list of all points on the skyline of I, sorted by y-coordinates in decreasing order. Let V(I) denote the sub-list of V(I) that contains the topmost point of every color α that occurs in V(I). The set TS(I) contains the first BlogN points from V(I). The y-coordinates of points in TS(I) are stored111We remark that lists V(I) and V(I) are not stored in our data structure. These lists were introduced in order to define TS(I). in the data structure of Lemma 15.

To find 𝚊𝚍𝚓(Q) for a top-open three-sided query range Q=[a,b]×[c,+), we first identify the chunks containing a and b. Let the chunks containing a and b be Ca and Cb respectively. The query Q=[a,b]×[c,+) is then divided into three parts: the left marginal query Qlmarg=[a,a11]×[c,+), the right marginal query Qrmarg=[b1+1,b]×[c,+) and the middle query Qmid=[a1,b1]×[c,+); the parameters a1 and b1 are chosen so that a11 is the right x-boundary of the chunk Ca and b1+1 is the left x-boundary of the chunk Cb. See Fig 6 for illustration. The marginal queries fit into individual chunks and the middle query spans an integer number of chunks. We will search for the appropriate adjusted right boundary in Qrmarg, Qmiddle and Qlmarg (in this order).

Figure 6: Procedure for finding 𝚊𝚍𝚓(Q). A query range Q is decomposed into Qlmarg, Qmiddle, and Qrmarg. Qmiddle is then decomposed into two overlapping query ranges, Qlmid and Qrmid.

The following lemma provides an explanation for our method. We will say that a query range Q is empty if PQ=.

Lemma 17.

Let Q=[a,b]×[c,+) and consider any r such that arb. If Qr=[r,b]×[c,+) is empty, then the adjusted right boundary of Ql=[a,r1]×[c,+) is the adjusted right boundary of Q.
If [r,b]×[c,+) is not empty, then the adjusted right boundary of [r,b]×[c,+) is the adjusted right boundary of Q.

Proof.

By definition, 𝚊𝚍𝚓(Q) is the largest x-coordinate of a point in Q, see Section 3. If the right region [r,b]×[c,+) is empty the rightmost point must lie in the left region Ql=[a,r1]×[c,+). Hence, 𝚊𝚍𝚓(Q)=𝚊𝚍𝚓([a,r1]×[c,+)). But if the right region Qr=[r,b]×[c,+) is not empty, there must be a point p in the right region such that p.x>p.x for any point pQl; hence 𝚊𝚍𝚓(Q) is the same as 𝚊𝚍𝚓([r,b]×[c,+)).

Lemma 17 can be applied iteratively and we can divide the query range into more than two parts in the same manner. Next, we present two more lemmas that will be used to describe the method for searching the adjusted right boundary.

Lemma 18.

Consider a canonical set I=[x1,x2] and a query range Q(I)=[x1,x2]×[c,+) for some c. Let right(TS(I))=(rx,ry) denote the lowermost point in TS(I). If cry, then there are at least BlogN distinct colors on the skyline of Q(I), where B is the size of the block.

Proof.

By definition, TS(I) contains BlogN topmost points with distinct colors from the skyline of I. Each such point p=(px,py)TS(I) satisfies px[x1,x2] and pyry. Since crypy, we conclude that pQ(I). Therefore all points from TS(I) are also in Q(I). Since points in TS(I) are on the skyline of I, they are also on the skyline of Q(I). Since all points in TS(I) have different colors, the skyline of Q(I) must contain at least BlogN distinct colors.

Lemma 19.

Consider a canonical set I=[x1,x2]×(,+) and a query range Q=[x1,x2]×[c,+) such that c>ry, where right(TS(I))=(rx,ry) is the rightmost (i.e., the lowermost) point in TS(I). A color α occurs on the skyline of QP if and only if it occurs on the skyline of QP, where Q=[x1,b]×(,+) and b=𝚊𝚍𝚓(TS(I),Q).

Proof.

Let p be the topmost point of color α on the skyline of QP. By definition of 𝚊𝚍𝚓(TS(I),Q), we have pxb, and since b is the rightmost x-coordinate among the topmost points of distinct colors on the skyline of Q, there is no point of color α in [b,x2]×[c,+) that dominates p. Also, since pyc, no point in [x1,b]×(,c] dominates p. Hence, p is on the skyline of QP and the color α occurs on the skyline of QP. Conversely, let p be the topmost point of color α on the skyline of QP. Since pQP, pxb. By definition of 𝚊𝚍𝚓(TS(I),Q), pyc and bx2. This implies pxbx2 and hence pQP. As p is already the topmost point of its color and lies to the left of b, no point in [b,x2]×[c,+)Q can dominate it. Therefore, p also lies on the skyline of QP and the color α must also be on the skyline of QP.

In what follows, we describe the method for searching the adjusted right boundary in detail (see Figure 6 for a visual illustration).

Step 1.

We calculate 𝚊𝚍𝚓(P,Qrmarg) or determine that QrmargP= using the data structure for the chunk that contains Qrmarg. By Lemma 17, 𝚊𝚍𝚓(P,Q)=𝚊𝚍𝚓(P,Qrmarg) if QrmargP, and using Lemma 16 we can find 𝚊𝚍𝚓(P,Qrmarg) in O(1) time. If Qrmarg is empty, we proceed with Step 2.

Step 2.

Let h=b1a1+1Δ. We divide Qmiddle into two query ranges, Qlmid and Qrmid. Let Qlmid=[a1,a1+2hΔ1]×[c,+) and Qrmid=[b12hΔ+1,b1]×[c,+). Let Ilmid denote the canonical set that contains all points with x-coordinates in [a1,a1+2hΔ1]. Let Irmid denote the canonical set that contains all points with x-coordinates in [b12hΔ+1,b1]. We observe that QlmidPIlmid and QrmidPIrmid for two canonical sets Ilmid=[a1,a1+2hΔ1]×(,+) and Irmid=[b12hΔ+1,b1]×(,+).

Step 2(a).

Let pt denote the topmost point in TS(Irmid) and let pl denote the lowermost point in TS(Irmid). Since points in TS(Irmid) are sorted by y-coordinates, we can identify pt and pl in O(1) I/Os. We distinguish between three different cases.

Case 1. pt.y<c:

In this case QrmidP= and we proceed with Step 3.

Case 2. pl.yc:

In this case we find 𝚊𝚍𝚓(Q) in O(logBN)=O(logN) I/Os, but we can show that kBlogN. By Lemma 18, the total number of colors on the skyline of Qrmid is at least BlogN. Since QrmidQ, kBlogN, where k is the total number of colors on the skyline of Q. Since kBlogN, the adjusted right boundary 𝚊𝚍𝚓(Qrmid,P) is found in O(logBN)=O(kB) I/Os.

Case 3. pt.yc and pl.y<c:

In this case it is sufficient to find 𝚊𝚍𝚓(TS(Irmid),Q) as can be concluded from Lemma 19. Since TS(Irmid) contains BlogN points, we can find 𝚊𝚍𝚓(TS(Irmid),Q) in O(1) I/Os using Lemma 15.

Step 3.

If QrmidP= , we process Qlmid in the same way as was described for Qrmid in Step 2.

Step 4.

If QlmidP=, we find 𝚊𝚍𝚓(P,Q)=𝚊𝚍𝚓(P,Qlmarg) in O(1) I/Os, in the same way as described for Qrmarg in Step 1.

Space Usage

Each individual chunk contains Blog2N points, and there are N/Δ chunks, where Δ=Blog2N. Therefore, the total space usage of chunk data structures is O(N). Additionally, TS(I) for every canonical set I stores O(BlogN) points, and there are O(NΔlogNΔ) canonical sets because for every chunk there are O(log(N/Δ)) sets of exponentially increasing size starting at the left boundary of that chunk. In total, the data structure occupies O(N) words.

Our procedure for transforming a three-sided top-open query range into a two-sided query range can be summarized in the following lemma.

Lemma 20.

For any query range Q=[a,b]×[c,+), we can find some value b that satisfies the following property: a color α occurs on a skyline of QP iff it occurs on the skyline of QP for Q=[a,b]×(,+). The cost of finding b is O(k/B) I/Os, where k is the number of colors on the skyline of Q and the underlying data structure uses space O(N).

Color Reporting Queries

The distinct colors on the skyline of Q=[a,b]×[c,+) can be reported as follows. We find the value of b, such that a color occurs on the skyline of Q iff it occurs on the skyline of Q=[a,b]×(,+). By Lemma 20 this can be done in O(k/B) I/Os where k is the number of colors on the skyline of Q. Then we access the partially persistent list Lc at the version b, i.e Lc(b), and traverse the list in order of decreasing x-coordinates. We stop when a point p with p.x<a is reached. For each point we report its color. The time required to examine all such points and report their colors is O(k/B) I/Os, where k is the number of points pLc(b) with p.xa. By Lemma 12, for every color on the skyline of Q there is exactly one point p with that color, such that pLc(b) and p.xa.

Theorem 21.

In the external memory model, there exists a O(N)-space data structure that answers top-open three-sided skyline color reporting queries on an N×N grid in O(kB)+1 I/Os.

The general case can be reduced to the case when points are on N×N grid at the cost of increasing the query cost by qpred(N); see the remark after Theorem 5.

7 Conclusion

In this paper we show that there is a gap between top-open and bottom-open three-sided skyline counting queries: while bottom-open queries have the same Θ(logN/loglogN) time complexity as four-sided skyline counting queries, top-open queries can be answered in O(loglogN) time. Our technique also lead to improved results on (top-open) three-sided skyline color counting and (top-open) three-sided range reporting in external memory.

One important open question related to our work concerns the complexity of four-sided skyline range reporting. The best data structure for four-sided range reporting in 2-D answers queries in O(loglogN+k) time. This time is known to be optimal. On the other hand, the fastest currently known data structure for four-sided skyline range reporting answers queries is O(logN/loglogN+k) time. Is there a data structure that uses NlogO(1)N space and supports four-sided skyline reporting queries in O(loglogN+k) time?

References

  • [1] Stephen Alstrup, Gerth Stølting Brodal, and Theis Rauhe. New data structures for orthogonal range searching. In 41st Annual Symposium on Foundations of Computer Science (FOCS), pages 198–207, 2000. doi:10.1109/SFCS.2000.892088.
  • [2] Bruno Becker, Stephan Gschwind, Thomas Ohler, Bernhard Seeger, and Peter Widmayer. An asymptotically optimal multiversion b-tree. The VLDB Journal, pages 264–275, 1996. doi:10.1007/s007780050028.
  • [3] Gerth Stølting Brodal and Kasper Green Larsen. Optimal planar orthogonal skyline counting queries. In 14th Scandinavian Symposium and Workshops (SWAT), pages 110–121, 2014. doi:10.1007/978-3-319-08404-6_10.
  • [4] Timothy M. Chan. Persistent predecessor search and orthogonal point location on the word RAM. ACM Transactions on Algorithms, pages 22:1–22:22, 2013. doi:10.1145/2483699.2483702.
  • [5] Ananda Swarup Das, Prosenjit Gupta, Anil Kishore Kalavagattu, Jatin Agarwal, Kannan Srinathan, and Kishore Kothapalli. Range aggregate maximal points in the plane. In 6th International Workshop on Algorithms and Computation (WALCOM), 2012. doi:10.1007/978-3-642-28076-4_8.
  • [6] Ananda Swarup Das, Prosenjit Gupta, and Kannan Srinathan. Counting maximal points in a query orthogonal rectangle. In 7th International Workshop on Algorithms and Computation (WALCOM), 2013. doi:10.1007/978-3-642-36065-7_8.
  • [7] Michael L. Fredman and Dan E. Willard. Surpassing the information theoretic bound with fusion trees. Journal of Computer and System Sciences, pages 424–436, 1993. doi:10.1016/0022-0000(93)90040-4.
  • [8] Harold N. Gabow, Jon Louis Bentley, and Robert E. Tarjan. Scaling and related techniques for geometry problems. In Proceedings of the 16th annual ACM Symposium on Theory of computing (STOC), pages 135–143, 1984. doi:10.1145/800057.808675.
  • [9] Arnab Ganguly, Daniel Gibney, Sharma V. Thankachan, and Rahul Shah. I/O-optimal categorical 3-sided skyline queries. Theoretical Computer Science, pages 132–144, 2021. doi:10.1016/j.tcs.2021.10.010.
  • [10] Anil Kishore Kalavagattu, Jatin Agarwal, Ananda Swarup Das, and Kishore Kothapalli. On counting range maxima points in plane. In Combinatorial Algorithms, 23rd International Workshop (IWOCA), pages 263–273, 2012. doi:10.1007/978-3-642-35926-2_28.
  • [11] Casper Kejlberg-Rasmussen, Yufei Tao, Konstantinos Tsakalidis, Kostas Tsichlas, and Jeonghun Yoon. I/O-efficient planar range skyline and attrition priority queues. In Proceedings of the 32nd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS), pages 103–114, 2013. doi:10.1145/2463664.2465225.
  • [12] J. Ian Munro, Yakov Nekrich, and Sharma V. Thankachan. Range counting with distinct constraints. In Proceedings of the 27th Canadian Conference on Computational Geometry (CCCG), 2015. URL: http://research.cs.queensu.ca/cccg2015/CCCG15-papers/44.pdf.
  • [13] Gonzalo Navarro and Javiel Rojas-Ledesma. Predecessor search. ACM Computing Surveys, 53(5):105:1–105:35, 2021. doi:10.1145/3409371.
  • [14] Yakov Nekrich and Gonzalo Navarro. Sorted range reporting. In 13th Scandinavian Symposium and Workshops (SWAT), pages 271–282. Springer, 2012. doi:10.1007/978-3-642-31155-0_24.
  • [15] Manish Patil, Sharma V. Thankachan, Rahul Shah, Yakov Nekrich, and Jeffrey Scott Vitter. Categorical range maxima queries. In 33rd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS), pages 266–277. ACM, 2014. doi:10.1145/2594538.2594557.
  • [16] Mihai Patrascu. Lower bounds for 2-dimensional range counting. In Proceedings of the 39th Annual ACM Symposium on Theory of Computing (STOC), pages 40–46, 2007. doi:10.1145/1250790.1250797.
  • [17] Jeffrey Scott Vitter. External memory algorithms and data structures: Dealing with massive data. ACM Computing surveys (CsUR), pages 209–271, 2001. doi:10.1145/384192.384193.

Appendix A Proofs of Lemmas 15 and 16

Lemma 22.

Let S be a set of integers such that |S|=O(Blog2N). There exists a data structure that uses space O(|S|) and supports predecessor queries on S in O(1) I/Os.

Proof.

If BlogN, then |S|B2. In this case we store S in a B-tree so that a predecessor query is answered in O(logB|S|)=O(1) I/Os. If B<logN, |S|log2N. In this case we store S in a fusion tree [7], so that a predecessor query is answered in O(loglogn|S|)=O(log|S|loglogn)=O(1).

Lemma 23.

Let P be a set of two-dimensional points such that |P|=O(Blog2N). There exists a data structure that uses space O(|P|) and answers range predecessor queries on P in O(1) I/Os.

Proof.

According to Lemma 7, the rightmost point in a query range Q can be found using a partially persistent data structure. If BlogN, we store the points in a partially persistent B-Tree [2]. If B<logN, we store the points in a partially persistent variant of the fusion tree.