Efficient kNN query for moving objects on time-dependent road networks

In this paper, we study the Time-Dependent k Nearest Neighbor (TD-kNN) query on moving objects that aims to return k objects arriving at the query location with the least traveling cost departing at a given time t. Although the kNN query on moving objects has been widely studied in the scenario of the static road network, the TD-kNN query tends to be more complicated and challenging because under the time-dependent road network, the cost of each edge is measured by a cost function rather than a fixed distance value. To tackle such difficulty, we adopt the framework of GLAD and develop an advanced index structure to support efficient fastest travel cost query on time-dependent road network. In particular, we propose the Time-Dependent H2H (TD-H2H) index, which pre-computes the aggregated weight functions between each node to some specific nodes in the decomposition tree derived from the road network. Additionally, we establish a grid index on moving objects for candidate object retrieval and location update. To further accelerate the TD-kNN query, two pruning strategies are proposed in our solution. Apart from that, we extend our framework to tackle the time-dependent approachable kNN (TD-AkNN) query on moving objects targeting for the application of taxi-hailing service, where the moving object might have been occupied. Extensive experiments with different parameter settings on real-world road network show that our solutions for both TD-kNN and TD-AkNN queries are superior to the competitors in orders of magnitude.


Introduction
With the proliferation of GPS-equipped devices, intelligent transportation services, e.g., DiDi [1], Uber [2], have served as essential travel tools for customers, which provide significant improvements against traditional service systems in terms of reducing taxi cruising time [3,4] and passengers' waiting time. Meanwhile, they also foster plenty of studies for location-based queries on road networks, among which the k nearest neighbor (kNN) query on moving objects plays an important role as a technical support for such service systems. In particular, given a query location, and a set of moving objects, the kNN query is to find the k nearest objects traveling from their current locations to the query location. The kNN query on moving objects has been widely studied [5][6][7][8][9] in the scenario of static road network, where the closeness between moving objects and the query location is measured by the road network distance.
In practice, however, the road networks are essentially dynamic, which means the traveling cost varies over time. On a time-dependent road network, the weight of each edge is usually associated with a function of time, rather than a fixed distance value. Accordingly, the kNN query on such time-dependent road network aims to return k objects that could arrive fastest. In this case, the solutions for kNN query on static road network are no longer utilitarian. Motivated by this, in this paper, we study the Time-Dependent k Nearest Neighbor (TD-kNN) query on moving objects under time-dependent road networks, which to the best of our knowledge has not been resolved by any of the existing studies. In literature, time-dependent road network query has been extensively studied for years [10][11][12][13][14][15][16][17][18][19][20][21], while most of them focus on fastest travel path query of a given source and destination pair. Additionally, kNN query for static objects, e.g., point-of-interest, on time-dependent road network [22][23][24][25][26] has been well addressed, where travel cost from the query location to the static objects is concerned. Nevertheless, it is not straightforward to adopt the aforementioned two trends of algorithms to solve the TD-kNN query on moving objects due to the following challenges.
Challenges: In a time-dependent road network, the travel cost from the moving object to the query location is different from the one from the query location to object with the same departure time. For example, consider the real-world case that one travel from his/her home to the office in the morning. In common sense, the cost from home to office would be much larger compared to the one from office to home during the rush hour. Thus, the algorithms [24][25][26] that return the kNN objects departing from the query location would not be helpful. In the static road network, such issue could be easily handled by developing a reverse graph of the original graph, where the cost from the query location to the object in the reverse graph would be equivalent to the one from the object to the query location in the original graph. However, building a reverse graph for a time-dependent road network is challenging as the cost of each edge is measured by a function of time. Moreover, the queries on time-dependent road network are usually very time-consuming since the travel cost for each edge along a path depends on the cost for its previous edge. For instance, consider the travel cost for a path {v 1 , v 2 , v 5 } on the time-dependent graph in Fig. 1. Let f (v i ,v j ) (t) be the cost function of an edge (v i , v j ). Then, the cost from v 2 to v 5 along this path is measured by f (v 2 ,v 5 ) (t + f (v 1 ,v 2 ) (t)). Consequently, without knowing the departure time, it is difficult to pre-compute the exact travel cost between some labeled vertices on the graph to accelerate the search.
Inspired from the framework of GLAD [6], which develops a light-weighted index to support efficient kNN query on moving objects under static road network, in this paper, we introduce an effective solution to solve TD-kNN query on moving objects. In particular, we use the uniform grid to index the moving objects, which is proved to be very efficient in updating the locations of moving objects. Then, we apply the expand-and-bound algorithm to explore the grid from the query location to retrieve the candidate objects. Next, the problem turns out to be how we can quickly refine the final results by computing the exact travel costs from the kNN objects to the query location. A naive way is to apply the existing algorithms for shortest path query on timedependent road network, e.g., TD-Dijkstra [27], TD-G-tree [13] to calculate the travel cost for every candidate object. However, as we will show in our experiment, the computational cost for such solution is huge. To this end, in our paper, we develop a labeling index for time dependent travel cost calculation, named TD-H2H, which extends the H2H index [28] for static road network to adapt to the dynamic scenario. Such extension is not straightforward as the labeling information is not a distance value but an aggregated weight function, which will be discussed in Sect. 4. To further improve the query efficiency, we utilize a static H2H index on a lower-bound graph to prune some objects that would never be the kNN results, and propose several pruning strategies to avoid some unnecessary computation. In addition, we extend this framework to answer the time-dependent approachable kNN query considering the scenario that the moving objects contain two conditions (occupied/non-occupied), for applications like taxi-hailing service.
To sum up, our work has four primary contributions: -We develop a TD-H2H index, which is able to return the fastest travel cost for any given pair of vertices on a time-dependent road network very efficiently. -We introduce efficient and novel algorithm for timedependent kNN query on moving objects, which has not been well addressed in literature. And, we propose several pruning strategies to further reduce the query time. -We extend our proposed solution to tackle the timedependent approachable kNN query on conditional moving objects considering more practical scenario. -We conduct extensive experiments with real-world road network to show the superiority of our proposed solution against the competitors. And the results show that our algorithm is more efficient than the competitors in orders of magnitude.

Related work
In this section, we discuss the existing works of the kNN query on the static and time-dependent networks, and the moving object kNN on the static network.

Static kNN query on static road networks
This is the most fundamental type of kNN where the network distance never changes and the objects never move.
Firstly, ROAD [29] expands the network until k objects are found. It speeds up the expansion by skipping the nonmoving objects sub-networks with the help of indexes and partitions. However, when the objects are distributed evenly, it would decay to the Dijkstra's algorithm. Therefore, the other approaches improve the efficiency by searching toward the promising objects with different heuristic functions and indexes [30]. For instance, TEN-QueryIP [31] pre-computes the top-k nearest objects for each vertex with the help of tree decomposition, and the query results are retrieved by combining these pre-computed top-k nearest objects. IER [32] computes the closest objects in Euclidean distance, until the minimum Euclidean distance is greater than the maximum network distance of the best k objects found. [30] uses PHL [33] as the underlying index for IER to speed up the retrieval of network shortest distance. Nevertheless, since the weights of the time-dependent road network vary over time, their indexes cannot solve the TD-kNN query directly. Moreover, because each vertex's top-k nearest objects are different at different time, and the moving object's position also keeps changing dynamically, the precomputed top-k information would become invalid and they can hardly be updated.

Static kNN query on time-dependent network
We first discuss the time-dependent routing briefly and then discuss the static kNN methods in this scenario.

Time-dependent route planning
The time-dependent networks use time-dependent functions, which is piecewise linear function, to describe the travel time of each edge on different departure time. When the departure time is a single time point, this problem is essentially the same as the static path problem and can be solved by any index-free shortest path algorithm. However, index cannot be built for it as it requires an index for each departure time. The more general time-dependent path problem deal with the cases when the departure time is an interval and finds the optimal departure time with the fastest path [10,11,[17][18][19]34,35]. However, its complexity lowerbound is Ω(|S|(|V |log|V | + |E|)) [36], where |V | and |E| are the vertex and edge number, and |S| is the turning point number of the result's time-dependent function. It should be noted that |S| is normally on the order of 2 or 3 magnitudes and no existing algorithm is close to this complexity, it would be very time-consuming to use them for TD-kNN query. Nevertheless, if we could build an index on it, it could answer both the interval departure and single departure query in constant time. However, the existing time-dependent indexes [13,15,16,20,37] are all search-based, which suffer from the high construction complexity (label / shortcut sizes ×Ω(|S|(|V |log|V |+|E|))) and take a long time to construct. Besides, the time-dependent index size is also very big, which is normally their static versions' size times |S|, and it normally takes hundreds of GB in real life [15,20]. Therefore, the concatenation-based method proposed in this work aims to reduce the time-dependent index's high construction cost.

Static kNN on time-dependent network
Since the query objects are static, it is easy to extend the static methods to the time-dependent environment. TD-NE [22] extends the search-based methods with the single departure time fastest path. However, its performance is limited by the searching algorithm. More importantly, it cannot solve our problem because it retrieve k objects that can be reached the fastest from the query point, but not the objects that can reach the query point, and such operation is not supported since the time-dependent function cannot be reversed like the static value. [23] extends the index-based method by dividing the whole time interval into several sub-intervals and precomputing the minimum travel time for each sub-interval. Then, during the search, an A*-like algorithm is utilized by referring to the minimum travel time from the index until kNNs are found. However, this index cannot facilitate queries effectively for large networks because the deviations are always too large between the estimated and the actual travel time. [25] utilizes the Voronoi diagram [24] with two complementary index structures: Tight Network Index (TNI) and Loose Network Index (LNI). The TNI/LNI cells for each data object are pre-computed based on the upper/lower bound of the travel time. If the query point locates in a TNI cell of an object, this object is definitely the nearest result of the query. Hence, the NN result can be obtained without performing any shortest path computation. On the contrary, if a query point is not in the TNI cell of any object, those objects whose LNI cell contains the query are taken as potential candidates, and they need to compute the shortest path for result verification. After that, [26] proposes another Voronoi-based index, which builds a Voronoi cell for object o when all the points within taking less time to o than to other objects at any departure time. Based on the Voronoi cells, the V-tree is constructed to manage all the closest cells to further speed up the query. However, both the Voronoi-based methods build the Voronoi cells based on the locations of objects. Once the object moves to a new location, multiple Voronoi cells will be affected and need to be re-calculated, which consumes huge computational costs in the moving objects scenarios.

Moving object kNN on static network
Different from the previous static kNN, the moving objects brings dynamic into this already complicated problem. Like the similar situation faced by the dynamic routing problem [38], the heavier (larger) index brings faster query perfor-mance, but it requires longer time to cope with the update [39,40]. Therefore, the lighter index structure is preferable in the moving object scenario. TOAIN [5] builds a shortcutbased index called SCOB which a throughput optimizing adaptive index, and it stores at each summit node the precomputed kNN objects. The query time is significantly improved, while the update cost for the precomputed kNN objects is large to some extent. It proposes several settings to further get the trade-off between query and update cost so as to optimize the system throughput. GLAD [7] verifies the efficiency of this idea to solve the kNN query of moving objects. It utilizes the light-weighted grid index to manage the moving objects which make the location update cost very small. Then, the distance between the query point and the border point of the outermost expanded grids is taken as the lower bound of the shortest network distance, which is used to filter out the objects very far away from query and verify objects by calculating and comparing their distances to query. By integrating the H2H index [28], which is the state-of-theart labeling-based solution for distances queries on the road network, GLAD significantly improves the throughput.

Preliminaries
In this section, we first introduce the important definitions, notations, and problem statement, and then, we describe our underlying structures H2H and GLAD.

Problem statement
We use the piecewise linear functions [13] as the timedependent function to describe the travel time of different departure time within the whole time domain T = [t s , t e ]. Specifically, given an edge where t 1 = t s and t k = t e as illustrated in Fig. 2. Figure 1 illustrates an example of a timedependent graph with 9 vertices and 16 directed edges, where the interpolation points of piecewise linear weight function for each edge is given in Table 1. Consider the travel cost for edge (v 1 , v 2 ) with a set of interpolation points {(0, 6), (20,12), (40,12), (60, 6)}. If a user departs at time 0 (resp.20), it takes 6 minutes (resp. 12 minutes) to travel from v 1 to v 2 .

Definition 3 (Time-Dependent Fastest Travel Cost (TFTC))
Given a source s, a destination d in G, and a departure time t, let P be the set of all possible paths from s to d in G. We have the time-dependent fastest travel cost from s to d defined as: Example 2 Consider the example in Fig. 1. Given a path P = v 1 , v 2 , v 5 with a departure time 20, we have T T C(P, 20) = 12 + 6 = 18. Given a source and destination pair v 1 and v 5 , and the departure time 20, there are three possible paths:

Definition 5 (Lower Bound Travel Cost)
Given a path P l = v 1 , v 2 , . . . , v n from G l , the travel cost for P l , denoted by C G l (P l ) is the sum of the weights along the path. Given a source vertex s and a destination vertex d in G l , let P be all the possible path from s to d. The lower bound travel cost from s to d is defined as L BC(s, d) = min P∈P C G l (P).
With the lower bound graph, we are able to determine the minimum travel cost for any given source and destination pair, regardless of the departure time. In this paper, we assume that G suffices the First-In-First-Out (FIFO) property, and the moving objects do not wait at any vertex while traversing along a path. Consider a set M of moving objects on the time-dependent road network. Following previous works [5,7], we assume that all moving objects are located on vertices. Given a query point q, a moving object o ∈ M on a time-dependent road network, to travel from o to q departing at time t, the minimum travel cost is calculated by T FT C(o, q, t). Accordingly, in our work, we study the k nearest neighbor (kNN) query on time-dependent road network, which is defined as follows.

Background knowledge
In this section, we introduce some background knowledge of H2H index and the framework of GLAD, which are the foundation of our proposed solution.

H2H index
H2H [28] index uses tree decomposition to organize the graph cut information and distance labels to support efficient distance query on a graph. Specifically, the tree decomposition maps a graph G = (V, E) (regardless of the edge weight) to a tree as follows: Definition 7 (Tree Decomposition [41]) A decomposition tree of a graph G(V, E), denoted as T G , is a rooted tree in which each node X ∈ V (T G ) is a subset of V (i.e., X ⊆ V) such that the following three conditions hold: ( For the rest of paper, we use ver tex for a vertex in the road network graph, and node for a node in the T G . We notate T (v) as the subtree induced by the set {X |v ∈ X } in T G and X (v) as the root node of T (v). The largest size of X (v) is denoted as tree-width W , and the tree height is denoted as h. [28]) Given a graph G(V, E), a subset of vertices V c ⊂ V is a vertex cut of G if the deletion of V c from G splits G into multiple connected components. A vertex set V c is called the vertex cut of vertices u and v if u and v are in different connected components by the deletion of V c from G. Property 1 Given a graph G(V, E), its decomposition tree T G , and an arbitrary node X (u) ∈ V (T G ), for any v ∈ X (u)\{u},

Definition 8 (Vertex Cut
Property 2 Given a decomposition tree T G for a graph G(V, E), for any two vertices u and v in V, suppose X (u) is not an ancestor/decedent of X (v) in T G , let X be the lowest common ancestor(LCA) of X (u) and X (v) in T G , then X is a vertex cut of u and v of G.
Based on the above properties, we have that the shortest path between two vertices must pass through a vertex in a vertex cut set. And the LCA of two vertices in the decomposition tree is a vertex cut. Hence, the following theorem can be easily obtained.
Theorem 1 Given a road network G, let C be a vertex cut for two vertices v and u, we have: To speed up the distance query efficiency, H2H precomputes the shortest distances between vertex to its ancestor and stores them in multiple arrays which are defined as follows. [28]) Given a decomposition tree T G for a graph G(V, E), for any node

Definition 9 (Ancestor Array
Given the above distance and position arrays, the distance query for any two vertices can be computed as follows. We first calculate the LC A of these two vertices in the decomposition tree and then scan the position and distance arrays to obtain the minimum accumulative distance from these vertices to the LC A, which is the shortest distance between the corresponding vertices.

GLAD
GLAD is a grid-based query framework for kNN query on moving objects in static road network. The basic idea is that GLAD takes H2H index as a black-box for distance query, and it partitions the road network into uniform grids to record the moving objects. When using GLAD index to answer kNN query, we start from where the query point is located to explore the grid to obtain the candidate objects, and calculate the distance from each object to the query point by H2H index. We narrow down the exploration space when more candidate objects are obtained until the minimum distance from the next object to explore exceeds the largest distance from the candidate objects to the query point. Finally, we refine the kNN results from the retrieved candidate objects.

TD-kNN query processing
Compared to the kNN query on the static road network, the major challenge to answer TD-kNN query is that the travel cost for any source and destination pair of vertices varies over time, and we can only determine the corresponding cost when a query is issued. Thus, it is impossible to pre-store some intermediate kNN results for a certain vertex to accelerate the query processing, like it does in many existing works, e.g., Vtree [8], TOAIN [5]. Moreover, though fastest path queries on time-dependent road network have been well studied [12], it is not straightforward to directly apply the existing solutions, e.g., TD-Dijkstra [27], TD-G-tree [13], to address TD-kNN query.
In particular, consider the simple TD-Dijkstra algorithm on the fastest path query. When given a pair of source and destination vertices s and d on a time-dependent road network G, the TD-Dijkstra algorithm starts from s to explore G and accumulates the cost based on the weight functions at the current time visiting a vertex. The algorithm terminates until it reaches d and returns the total cost from s to d. Note that, unlike the distance-based shortest path query, even in an undirected graph, the TD-Dijkstra returns different costs for the paths from s to d and from d to s, since the cost varies with the time reaching a vertex. On the other hand, applying Dijkstra's algorithm for the kNN query on the static road network, one can simply start from the query point and explore the road network with a reverse topological structure until obtaining the top-k objects encountered during the exploration. However, in terms of the TD-kNN query, a similar strategy on TD-Dijkstra is incapable of achieving the correct results. This is because starting from the query point to explore the graph can only return the nearest objects departing from the query point, while based on our definition, we aim to obtain the objects that can arrive at the query point with the least travel cost and the travel cost from a query vertex to an object is completely different with the one from the object to the query under the dynamic weight circumstance. A similar issue also appears in TD-G-tree.
To tackle the aforementioned challenges, in this paper, we extend the framework of GLAD [6] to handle TD-kNN query, which develops a grid and H2H [28] labeling index for kNN query on moving objects under static road network. Recall that in GLAD, the road network is partitioned into uniformed grids, and then, a data structure is maintained to record the moving objects that fall into the corresponding girds. In addition, a distance labeling scheme H2H [28] on road network is integrated for efficient distance query between two vertices. To answer the kNN query, we start from the grid where the query point locates and expand the grid from size 1 × 1 to 3×3, 5×5, . . . until the kNN objects are retrieved. Whenever an object is found, we invoke the distance scheme H2H to calculate the exact road network distance between the moving object and the query location so as to refine the final kNN results. The remarkable advantage of this framework is that the update cost of the index for moving objects is slight, even when the locations of objects are updated very frequently. Refer to the original paper [6] for more details.
In our work, we adopt the same paradigm as GLAD for the TD-kNN query, where we first search for the candidate objects, followed by travel cost calculation for refinement of final results. However, the current index structure from GLAD is considerably insufficient for the time-dependent scenario since the H2H index can only answer static distance queries between two vertices. Alternatively, we can replace the phase of distance query with the time-dependent fastest travel cost query by applying the TD-Dijkstra algorithm or the TD-G-tree index. Nevertheless, the computational cost would be huge, since the time complexity for each time-dependent fastest travel cost by applying TD-Dijkstra is at O(|V | · log|V | + |E|) and that by TD-G-tree costs O(log 2 2 k f · |V | · log 2 2 |S|) [13]. It should be noted that |S| here is the interpolation point number in the labels' functions so it is much larger than the edge functions'. In this paper, to improve the efficiency of the travel cost query, we develop a time-dependent H2H (TD-H2H) index by improving the original H2H index to support the time-dependent fastest travel cost query, which exactly makes up for the deficiency of the framework in GLAD.

TD-H2H index structure
In the rest of this paper, we consider a decomposition tree T G on time-dependent directed graph G. We first give a theorem derived from the definition of vertex cut.
Theorem 2 Given a time-dependent road network G, let C be a vertex cut for two vertices v and u, we have: (2) Next, we introduce the TD-H2H index, which extends the H2H to build the labeling index based on time-dependent road network. Given two adjacent edges, we can aggregate their weight functions to derive the weight function for the path Then, we formally define the aggregated weight function for given two paths from v i to v j and from v j to v k as follows.
In the rest of this paper, we use both f (v,u) and f (v u) to denote the weight function for an edge (v, u).
Min Operation on Weight Functions. Given two different weight functions regarding the paths with the same source , we define the min operation as follows.

Example 3 Given two adjacent edges
Based on the above definitions, we introduce the vertex elimination that preserve the weight functions as follows.

Definition 11 Function Preserved Vertex Elimination.
Given a graph G(V , E, F) and a vertex v ∈ V , the Vertex Elimination operation on v in G is as follows: For every Algorithm 1 gives the pseudocode of function preserved vertex elimination for one vertex on a given graph. Accordingly, we introduce the algorithm of function preserved tree decomposition, which is similar with the tree decomposition algorithm in [28]. The pseudocode is shown in Algorithm 2. In particular, let H be a duplication of G and N (v, H ) indicates the neighbors of v in H , which includes all in-neighbors and out-neighbors. Lines 3-8 iteratively eliminates the vertex v with the smallest degree in graph H . And for each v, we create a node X (v) in T G , which is a star containing not only the vertices {v} ∪ N (v, H ), but also the edges (v, u) with Algorithm 2: Function Preserved Tree Decomposition (FPTD) H ). We construct the tree structure by assigning the parent node for each X (v) in Lines 9-12. For the sake of efficiency, we sort the vertices in X (v) in decreasing order of π value, which is assigned to each vertex in Line 8. Then, in Lines 13-16 we maintain a data structure for the weight functions of the edges from the in-neighbor x i to v (resp. from v to the out-neighbor x i ). Here, we suppose f (v,v) = (0, 0), (60, 0) (t ∈ [0, 60]). Finally, we return T G as the decomposition tree in Line 17. Fig. 1. To construct T G , we first pick v 2 , and create a node X (v 2 ) in T G which contains a star with two edges (v 1 , v 2 ), (v 2 , v 5 ) and the corresponding weight functions as shown in Table 1. We eliminate v 2 by updating edge (v 1 , v 5 (11,15), (20,18), (60, 18)}. The process stops when all vertices are eliminated. For node X (v 2 ), after sorting the vertices in X (v 2 ) in decreasing order of their π values, we obtain the order v 1 , v 5

Example 4 Consider the example in
Similar to the H2H index that uses arrays to pre-store distances, in our TD-H2H we maintain the function arrays for each node in the decomposition tree T G , which is defined as follows.
Function Arrays. The function arrays for X (v) is defined as f (w l v) ). To explain, the function array of X (v) is the array for the weight functions from v to every vertex in X (v).anc and from every vertex In addition, for efficient lookup of weight functions in the function arrays, we also maintain the position arrays for each node in the decomposition tree as follows. Fig. 3, we have the function arrays as . And the position array for X (v 8 ). pos = {2, 3, 4, 5} since v 1 , v 5 , v 3 , and v 8 are the 2nd, 3rd, 4th and 5th value in X (v 8 ).anc.
Next, we introduce the algorithm to construct the TD-H2H index. The main idea to build the TD-H2H index is to Fig. 3 Tree decomposition T G first construct the function preserved tree decomposition T G and then generate the aforementioned function arrays and position array for each tree node.
Let G(v) be the union of all the stars for nodes in the path from X (v) to the root of T G . We have the graph G(v) to be a supergraph of G(u) for any u ∈ X (v).anc. In this case, we can reuse the partial label information in X (u) while computing the label for X (v). Hence, we calculate the vertex labels in a top-down manner in T G . In particular, for any is an ancestor of X (v) in T G based on Property 1. Thus, before we calculate the function arrays of v, the weight function f (x j X (v).anc i ) and f (X (v).anc i x j ) have been obtained. Moreover, for any Thus, we can calculate the function arrays for every vertex with the following lemma.

Lemma 1 For any 1
According to Lemma 1, to obtain the function arrays, we need to compute f (x j X (v).anc i ) and f (X (v).anc i x j ) for each x j ∈ X (v) (1 ≤ i < |X (v).anc|). We consider the following two case: The pseudocode of the algorithm to construct TD-H2H index is shown in Algorithm 3. First, we initialize the maximum and minimum weight functions f max and f min in Line 1. In Line 2, we construct the decomposition tree T G invoking the Algorithm 2. Lines 3-20 iteratively examine all nodes X (v) in T G in a top-down manner. In particular, for each node X (v), we first compute its position array (resp. X (v) i . f i ) for the weight functions from v to the i-th ancestor, X (v).anc i (resp. from X (v).anc i to v). After the initialization in Lines 7-9, for each element x j (except for the last one) in X (v), we first compute f (x j X (v).anc i ) and f (X (v).anc i x j ) based on Lemma 1 and the aforementioned two cases. Then, we conduct a Min operation on .anc i ) according to Definition 10 in Lines 17-18. In Lines 19-20, we set the last element in the function array to be f min since they are the weight functions between v and itself. Finally, we return the function and position arrays for all nodes as the TD-H2H index in Line 21, which finish the TD-H2H index construction.

Time Complexity Analysis.
Consider the time complexity of Algorithm 2 for the tree decomposition. Firstly for the function preserved tree node formation (lines 3-8), each vertex takes O(W 2 · |S|) time to form new edges, and the time to order vertices costs O(|V | · log|V |), so it takes O(|V |(W 2 · |S| + log|V |)). Regarding the tree formation (lines 9-12), it takes O(|V | · W ) time to find the parent from each node's W vertices to form the tree. The sorting organization (lines 13-16) takes O(|V |W log W ) time. Therefore, Algorithm 2 takes O(|V |(W 2 · |S| + log|V |) time. As for Algorithm 3, it takes O(|V | · W · h · |S|) time to compute the labels. Because W ≤ h − 1, the total time complexity of TD-H2H construction is O(|V |(W · h · |S| + log|V |)).

Space Complexity Analysis.
Our TD-H2H index structure mainly consists of the Position Array and Function Array. For each node X (v) in T G , X (v). pos is a subset of X (v).anc, whose size is no larger than h, where h denotes the height of the decomposition tree. And X (v). f stores all the timedependent functions between v and the nodes in X (v).anc. Therefore, the space complexity of TD-H2H index is at O(|V | · h · |S|).

Answering TD-kNN query
After the index construction, in this section, we introduce the algorithm to answer the TD-kNN query. Recall that in GLAD, the H2H index is served as the distance oracle for any pair of vertices in the graph. Similarly, in our solution, we compute the time-dependent fastest travel cost during TD-kNN query processing using the TD-H2H index. Consequently, let us first introduce the algorithm to compute the time-dependent fastest travel cost for any given pair of vertices.

Time-dependent fastest travel cost query
Given a pair of source and destination vertices s and d on G(V , E, F), a departure time t, and the TD-H2H index, the major process to answer the time-dependent fastest travel cost query is to find out the LC A of X (s) and X (d) in the decomposition tree T G , and then calculate the result based on its function arrays. The underlying rationale can be given by the following theorem.

Input: G(V , E, F), a source s, a destination d, time t and the H2H-Index Output: T FT C(s, d, t) 1 X L ← the LC A of X (s) and X (d) in T G
if tmp < r then 6 r ← tmp 7 Return r ;

Theorem 3 Given a pair of source and destination vertices s, d, the decomposition tree T G of a road network G, and the corresponding TD-H2H index, let X L be the LC A of X (s) and X (d) in T G , we have:
Proof According to the definition of TD-H2H index, suppose X L = {w 1 , w 2 , . . . , w l } sorted in ascending order of their positions in X L .anc. Thus, we have T FT C(s, X L .anc i , t) =

T FT C(s, X (s).anc i , t) for any 1 ≤ i ≤ |X L .anc|. Based on Theorem 1, we can get T FT C(s, d, t) = Min v∈X
Thus, we finish the proof of this theorem.
Based on Theorem 3, we can simply scan the function arrays X (s) o . f and X (d) i . f to find the weight functions f (s X (x).anc) and f (X (d).anc d) , respectively, and calculate the travel cost with Equation 3. Algorithm 4 shows the pseudocode for computing the time-dependent fastest travel cost. In particular, we apply the same method in [28] to calculate the LC A in constant time. Then compute the cost based on Theorem 3. We give an example to show how the query process as follows. Fig. 1. Given a query T FT C(v 7 , v 0 , 20), with a partial TD-H2H index as shown in Fig. 4, we first get LCA(v 7  Complexity Analysis. The time cost of TFTC query based on the TD-H2H index is mainly caused by the LC A query for two nodes in the decomposition tree T G and the retrieval of the function arrays. According to [28], the computational cost for the LC A query is at O(1). Since we have that the largest size of X (v) in the decomposition tree is bounded by the width of the tree. Thus, the total computational cost of the TFTC query is bounded by O(W ), where W is the tree width.

TD-kNN query
Next, we introduce the algorithm to answer TD-kNN query. As aforementioned, our framework is similar to that in GLAD while replacing the H2H index with the TD-H2H index. Nevertheless, to further improve the query efficiency, in our work, we propose two pruning strategies as follows.
Lower-bound Cost Pruning. Based on Definition 5, we observe that if the lower bound travel cost from an object o a to the query point q is larger than the exact time-dependent fastest travel cost from another object o b to q, then o a can be pruned by o b regardless of departure time.

Observation 1 Given two objects o a , o b , a departure time t, and a query point q, if L BC(o a , q) > T FT C(o b , q, t), then we have T F T C(o a , q, t ) > T FT C(o b , q, t) ∀t ∈ [t s , t e ].
Motivated by this observation, in our work, we build an H2H index on the lower bound graph (Ref. Definition 4). Then, after retrieving the first k candidate objects with the corresponding T FT C values, during the further exploration to discover other objects, we can first calculate the lower bound travel cost for them based on the H2H index, to see whether they can be pruned by the k-th candidate object we have found. In this way, unnecessary computation of timedependent travel cost for some objects can be avoided, which can significantly show in Sect. 6.
Label Pruning. Recall that according to Theorem 3, the computation of time-dependent fastest travel cost for two vertices s, d actually contains two portions: the travel cost from s to the label in its LC A nodes in the decomposition tree, and the cost from this label to d. We observe that if two objects pass through the same label, we can omit the second part of computation for one of the labels based on the following observation. two objects o a and o b , a query point  q with a departure time t, let v be a common label of  them, i.e., v ∈ LC A(X (o a ), X (q)) ∩ LC A (X (o b ), X (q)). If T T C(o a , v, t) > T T C(o b , v, t), based on the FIFO property, we have T T C(o a , v, t)+T T C(v, q, (t+T T C(o a , v, t) T C(o b , v, t)

)). Note that T T C is calculated by the aggregated weight functions as shown in Theorem 3.
Consequently, consider an object o f , which has been filtered (this object will never appear in the result set). Suppose that we have another object o c to be examined and we , then based on Observation 2 we can omit the computation of T T C(v, q, (t + T T C(o c , v, t)) since the total cost must be larger than that of o f . Motivated by this, during query processing, we maintain a buffer for each vertex v to record the smallest travel cost from all the current filtered objects to v at the query time, i.e., min o i ∈O f T T C(o i , v, t), where O f is the set of objects being filtered at the current stage of query processing. During query processing, we check this buffer to see whether we can avoid the second part of computation for some objects. And we update this data structure after the examination of each candidate object.  v 2 , t)).
Query Algorithm. The pseudo-code of the TD-kNN query algorithm is shown in Algorithm 5. We start from the grid of Let T k be the k-th largest travel cost of objects in C; Let N H be the set of grids that are neighbors of H but excluding the grids in H ; 25 Let D L be the minimum Euclidean distance from q to the edge of N H, L B ← D L /speed max ; 26 return top−k objects in C with fastest travel time; size 1 × 1, and then gradually expanding the grid to 3 × 3, 5 × 5,…until the kNN candidates are found. Then, during the further exploration, we set an lower-bound cost to be the cost travel from the boundary of explored grid to the query point with the maximum speed admitted for the whole road network. Lines 1-5 illustrate the initialization of this algorithm. We maintain a set C to record the candidate objects, and a set H for the grids to explore. Let N H to be neighbor grids surrounding H , and initially set to be {h}, which is the grid where q is located. We use U B to indicate upper-bound cost of the k-th nearest neighbor to q and L B as the lowerbound as aforementioned. For each object o, we maintain a T (o, q) to denote the current travel cost from o to q, and for each vertex v, we use v.c to indicate the buffer for the smallest cost from all the current filtered objects to v. Then, we start the iteration to explore the grid and retrieve candidate objects. At the beginning of each iteration, we check whether the current upper-bound value has exceed the lower-bound, and later we update both to narrow down the gap of them to accelerate the convergence. In Lines 7-10, we calculate the travel cost of all moving objects in N H to the query location q using TD-H2H index, and add these objects to the candidate set C until we get k objects. Let T k be the k-th largest cost among those in C. In Line 13, we calculate the lower bound cost L BC(o, q) with the H2H index, and check whether L BC(o, q) is larger than T k . If so, we can prune this object based on Observation 1. Otherwise, in Lines 14-17, for each v ∈ LC A(o, q), we first calculate the travel cost T T C(o, v, t) and check v.c to see whether we can omit the further computation based on Observation 2. Alternatively, in Lines 18-22, we calculate the exact travel cost for this object and update C and T k accordingly. After this iteration, in Lines 23-25, we update H to include the grids in N H and update N H by exploring the next surrounding grids. And we update the upper-bound and lower-bound cost based on the current results. At the end, we return the top-k objects with the fastest travel cost in C as the TD-kNN query answer.
Complexity Analysis. The time complexity for the TD-kNN query is based on two parts: the cost of grid expansion and the cost TFTC query for each object. Though we propose several pruning strategies, at the worst case, for each object we need to compute both the TTC and TFTC query, each of which is bounded by O(W ) as analyzed in Sect. 4.2.1. Thus, the overall computational cost for the TFTC part is bounded by O(W |M avg |), where |M avg | denotes the average number of objects retrieved during query processing. Note that in the worst case, |M avg | could be up to |M|, which is the total number of objects. As for the grid expansion, the cost is bounded by the number of objects to retrieve, which is dominated by the TFTC part. Consequently, the time complexity for our TD-kNN query is at O(W |M avg |). In contrast, the time complexity of TD-kNN query for TD-Dijkstra and TD-G-tree is at O(|M avg |(|V | · log|V | + |E|)) and O(|M avg |(log 2 2 k f · |V | · log 2 2 |S|)), respectively.

Extension on TD-kNN query
Applications of TD-kNN query can be found in the taxihailing service, where each moving object represents a taxi running on the road network. When a user proposes a taxi request, the system finds the k nearest taxis and assigns one of them to serve the user based on some specific strategies.
In this case, we consider all the moving objects available to serve. However, in practice, some of the taxis might have been occupied by existing users, and these occupied objects might arrive at their destinations soon so that they could also approach the query point in a short time. In [42], the authors propose the Approachable k Nearest Neighbor (AkNN) query, which takes into consideration of both occupied and unoccupied moving objects, e.g., taxi. We give such objects a specific definition as follows.

Definition 12 (Conditional Moving Object)
We define the conditional moving object o c on the time-dependent road network as a tuple, i.e., o c = ( p c , p d , c), where p c (resp. p d ) indicates the current (resp. the imminent destination) location of this moving object, and c represents the condition (occupied/non-occupied). We have c = 1 to represent "occupied" and c = 0 for "non-occupied" condition. Note Given a set of non-occupied/occupied moving objects M c and a query point on the time-dependent road network, we aim to return the k nearest objects those can earliest response to the request after they finish their current journey (arrive at the destinations). These objects are regarded as the imminent approachable candidates to serve the requests. Thus, we calculate the travel cost from a conditional moving object to the query point by summarizing the cost from its current location to its coming destination and the cost from its coming destination to the query point. Formally, we define the time-dependent approachable kNN as follows. AkNN)) Given a query point q, a set M c of moving objects on a time-dependent road network G(V , E, F), a departure time t, and an integer k ≤ |M c |, time-dependent approachable kNN returns a subset R ⊆ M c of k moving objects such that for all

Definition 13 (Time-dependent Approachable kNN (TD-
To address the TD-AkNN query, we adopt the same framework like the one for the TD-kNN query. Note that in this case, each moving object contains two locations. In our work, we maintain the grid index only based on the destination location. Moreover, we regard the time-dependent fast travel cost computation based on the TD-H2H index as a black-box. Particularly, the pseudo-code of the algorithm for TD-AkNN query is shown in Algorithm 6. Lines 1-4 illustrates the same initialization as the ones for the TD-kNN Algorithm 5. We also maintain a set C to hold candidate objects. In Lines 6-9, for the object o c with o c . p d ∈ N H, we calculate the travel cost of path {o c . p c , o c . p d , q} with TD-H2H index, and add them to C until we get k candidate objects. Then, we set the k-th largest travel cost among the objects in the candidate set C as T k in Line 11. In Line 12, before we calculate the fastest travel cost from o c to q, we first calculate the lower bound cost of path {o c . p c , o c . p d , q}. If the lower bound cost is larger than T k , we do not need to calculate the travel cost for o c . Otherwise, in Line 13, we calculate the travel cost tmp of path Let T k be the k-th largest travel cost of objects in C; Let N H be the set of grids that are neighbors of H but excluding the grids in H ;

18
Let D L be the minimum Euclidean distance from q to the edge of N H, L B ← D L /speed max ; 19 Return top−k objects in C with fastest travel time; If tmp is smaller than T k , which means o c can be a candidate object, then we update the candidate set C and T k accordingly in Lines 14-15. After that, we use the same method as that in TD-kNN to update H , U B, N H, and L B. Finally, we return the top-k objects with the fastest travel cost in C as the TD-AkNN query answer.
Complexity Analysis. Since Algorithm 6 searches the objects in a similar way to Algorithm 5, they have the same time complexity, which is O(W |M avg |). However, the calculation of the lower bound cost and TFTC of each moving object needs to be done twice for the TD-AkNN query due to the occupancy, so the query time will be longer than performing a TD-kNN query.

Experimental study
In this section, we present the experimental study to show the performance of our proposed solutions for the timedependent k nearest neighbor queries. We first introduce the experimental setting, followed by the results with various parameter settings.

Experimental settings
Datasets: We conduct our experiments on real road network from New York city (NY) and Beijing city (BJ). To  evaluate the scalability of our algorithms, we extract three sub-networks from NY, following the same idea in TOAIN [5]. Specifically, we gradually expand the road network from the center of New York city to get a certain number of vertices and the corresponding edges. We denote these three sub-networks as NY1, NY2, and NY3. Table 3 shows the sizes of vertices and edges for different datasets, and NY is the default dataset. The height and width of the decomposition tree of these datasets are also shown in Table 3. It is worth noting that although NY and BJ have similar numbers of vertices, the distribution of vertices in BJ is much denser. As a result, the height and width of the decomposition tree are larger than those of NY, which is in line with the results in [31].

Queries:
We randomly choose 10,000 vertices as the query points, and randomly select a departure time for each of them within the whole time range of [0,1440]. In particular, for the number of interpolation points, the default value is 4, which are (x 1 , y 1 ), (x 2 , y 2 ), (x 3 , y 3 ), (x 4 , y 4 ). Next we will introduce how to generate the piecewise linear weight function for each edge. Ideally, the weight functions could be extracted The intuition is that during mid-night, the traffic flow is smooth and the vehicle usually can have free flow speed, while during day time there could be some deduction due to the increase of traffic flow. Table 2 shows all the parameter settings in our experimental study, where the default values are marked in bold.

Methods:
As discussed in Sect. 4, there is no existing solutions for TD-kNN query. But our proposed framework for both TD-kNN and TD-AkNN can be easily integrated with any existing time-dependent fastest travel cost (TFTC) query algorithm. In order to evaluate the efficiency of the designed framework as well as the superiority of our proposed TD-H2H index, we apply the same framework to incorporate the TD-G-tree index and TD-Dijkstra algorithm as our competitive solutions. We simply denote these algorithms as TD-H2H, TD-G-tree, and TD-Dijkstra, respectively. In other words, the above three algorithms use the same framework but invoke different TFTC query algorithms to calculate the time-dependent travel cost from an object to the query point.

Index construction
We first compare the performance of the proposed TD-H2H index with the existing TD-G-tree under different datasets and different numbers of interpolation points for the weight functions. Recall that the construction of the TD-H2H index involves tree decomposition of the graph, calculating the time-dependent weight functions between each vertex in the decomposition tree and its ancestors, and storing them in an array of weight functions. By contrast, the TD-G-tree index involves partitioning the graph into a balanced tree structure, calculating the weight functions between boundary vertices and between the non-boundary vertices and boundary vertices, and storing these functions in matrices on the non-leaf nodes and leaf nodes in the tree. Figure 6 shows the experimental result of index construction in comparison with the TD-G-tree. As we can see, TD-H2H needs more space for weigh functions than TD-G-tree, while taking less time to construct the index at all settings. The index size of TD-H2H is about 3 times that of TD-G-tree, and this is because TD-H2H maintains the weight function array for every vertex, while TD-G-tree only stores them for a small set of vertices, e.g., the boundary vertices. However, with improved storage and memory hardware, an index size at about 30GB is acceptable for a whole NY road network. Since TD-H2H computes the weight functions in a top-down manner, it reuses the existing information to reduce the overall computational cost.
Effect of network size. It is obvious that the index size and construction time will increase as the road network becomes 1 The source code, data, and/or other artifacts have been made available at https://github.com/jiajia4487/TD-H2H-kNN.
larger, as shown in Fig. 6a and b. The size of TD-G-tree grows more slowly than TD-H2H, because its boundary vertices do not increase dramatically with the growth of network size, while the index size of our TD-H2H increases faster since the more vertices, the heavier weight functions required. The index construction efficiency of TD-H2H is less affected by the size of the network compared with the TD-G-tree, which also benefits from the re-usage of partial information from the ancestors of a node in the decomposition tree. In addition, the index for BJ road network requires larger space and more construction time compared to NY, though they have the similar number of vertices. This is mainly because the topological structure in BJ road network is more complex than that of NY, resulting in larger height and width in the decomposition tree as illustrated in Table 3.
Effect of the number of interpolation points. As illustrated in Fig. 6c and d, the index size and construction time of both indices increase as the size of interpolation points increases. That is because the number of the interpolation points of the aggregated weight function of a path will increase exponentially when aggregating more weight functions, which makes sense, and the impact for both indices is similar to the scenario of varying map size.

Fastest travel cost query processing
As introduced in Sects. 4.2 and 5, the TFTC query will be invoked multiple times in order to answer a TD-kNN or TD-AkNN query. Thus conduct a set of performance comparisons among the proposed TD-H2H index and the existing TD-G-tree index and TD-Dijkstra algorithm in supporting the TFTC query.
Effect of the source-destination distance. We randomly generate 100K pairs of source and destination points under NY dataset, and set the departure time randomly. The TFTC query is issued for each pair, and the corresponding response time is recorded. Then, the shortest road network distances of these 100K pairs on the road network are calculated, respectively, and divided into 4 intervals by distances, i.e.,   Figure 7 shows the query time distribution for different solutions, where each point indicates the query time of one request. As we can see, with the increase in road network distance, the query time of TD-Dijkstra increases dramatically. This is because TD-Dijkstra expands the graph from the source point until it reaches the destination, whose query efficiency is naturally related to distance.
TD-G-tree shows more stable performance than TD-Dijkstra, because it skips a large number of unnecessary vertices. Nevertheless, when the two points are far away, and their least common ancestor (LCA) is close to the root node, the number of boundary points that need to be verified increases, which will also lead to a deduction of efficiency. As for the TD-H2H index, its efficiency depends more on the size of the array in the LCA, which is related to the contraction order of this LCA rather than the distance. Consequently, it is least affected by the distance, which means our solution is more robust to the TD-kNN query with various underlying road network distances.
(a) (b) Fig. 9 Query processing with two pruning strategies Effect of network size and number of interpolation points. Figure 8 illustrates the average running time for answering TFTC query of three algorithms under different datasets and different numbers of interpolation points for each edge. It can be seen that when the network size increases, the query response time of the three algorithms all increase. TD-Dijkstra increases the fastest because in a larger road network, the source and destination point might be farther , and more vertices need to be traversed. As for TD-G-tree and TD-H2H, a larger network indicates a deeper decomposition tree, and the growth of boundary points (in TD-G-tree) and associated vertices (in TD-H2H) in LCA will increase the query time. In terms of the interpolation points, the aggregated weight functions pre-computed for the matrices in TD-Gtree and the arrays in TD-H2H will increase greatly, resulting in a longer lookup time when calculating the travel cost. In contrast, TD-Dijkstra does not concatenate the weight functions but directly calculates the arrival time while exploring each edge. Hence, the increased lookup time is less, so it is less affected by the number of interpolation points. As we can see, the TD-H2H always beats the other two solutions in orders of magnitude.

Effectiveness of pruning strategies
We evaluate the effectiveness of the pruning strategies based on Observation 1 and 2, and we denote these two strategies as P1 and P2, respectively. We first conduct a case study to see how well these two pruning strategies work. In particular, we perform 100K queries and keep track of both the numbers of objects that have been visited and the numbers of TTC computations of each query processing for evaluating the pruning power of P1 and P2, respectively. That is because P1 helps to filter those unpromising objects, while P2 helps to omit the second part of computation for some vertices in an LCA of the examined object and query point. For each setting, we conduct the same set of queries twice and record the sizes of traversed objects and calculated TTC, respectively, so that we can obtain the pruning power. Formally, we define the number of objects visited with (resp. without) pruning as O p (O np Table 4 shows the results of pruning power while varying k under the maps of New York and Beijing, where P1 means we only apply the first strategy.
As we can see from the interesting results, as the value of k grows, the trends of the pruning power of P1 and P2 are opposite under both road networks. However, the performance of P1 and P2 is very different regarding different road networks. As described in Sect. 4.2.2, if the lower bound cost of the object is larger than T k , it can be pruned safely, where T k represents the cost of the k-th moving object found so far. Obviously, a smaller value of T k means that more objects can be filtered out. As k increases, it needs to search larger space to obtain final results and then T k increases accordingly. Hence, the pruning power of P1 becomes weaker. Regarding P2, with more objects to verify, we might find more objects sharing the same LCA. Therefore, as k increases, the pruning power of P2 turns out to be stronger. As for the performance of the pruning power under different road networks, it is closely related to the properties of road networks. As mentioned in Table 3, although both road networks have a similar number of vertices, the lengths of road segments in BJ are generally shorter than those in NY. Since the length of the road segment is taken into account when generating the time-dependent functions, the change in the travel time of the shorter road segment is smaller. Therefore, when utilizing the lower bound of travel time for pruning by P1, fewer edges can be filtered out in BJ, so the performance of P1 is worse than that in NY as shown in Table 4. P2 also performs worse in BJ, since the decomposition tree of BJ has a larger width, so that there are fewer vertices passing through the same LCA. Next, we evaluate the combination of the pruning power by reporting the query processing time with or without the pruning strategies. Figure 9 shows the results varying the value of k. As we can see, the query time without pruning nearest doubles that with pruning for TD-kNN, and the pruning advantage is more significant in answering TD-AkNN.

Efficiency of TD-kNN query
We compare the TD-kNN query efficiency of three solutions by varying four different parameter, i.e., k, object size |M|, gird length L, and network size. Figures 10 and 11 show the results of four sets of experiment on the maps of NY and BJ, respectively, each of which is the average query time over 100K queries. For all settings, our solution achieves 2-3 orders of magnitude faster than the TD-G-tree and TD-Dijkstra.
From Fig. 10a, we can see that the query time increases as k increases for all solutions, as the larger k indicates more exploring space to retrieve moving objects, thus higher computational cost. As for the object size, the query time of all algorithms decrease slightly, as shown in Fig. 10b. This trend is similar to the impact of the road network distance on the TFTC query. The underlying intuition is that the increase of |M| leads to a higher density of moving objects. Thus, k objects can be found quicker, and the exploration space from the query point to its kNN is smaller. As illustrated in Fig.  10c, L has little impact on the query time of all algorithms for TD-kNN query. Intuitively, the smaller L, the more grid levels need to be explored, and vice versa. However, bene- fiting from the pruning strategies, the influence of L reduce for retrieving the candidate objects. In terms of network size, when the network becomes larger, the query time increases very slightly for three solutions as illustrated in Fig. 10d. The size of network is closely related to the height and width of both tree structures generated by TD-G-tree and TD-H2H, thus increasing the overall query time. The TD-Dijkstra algorithm is very sensitive to the exploration space. With larger network and randomly generated query, there could be some queries requiring larger exploration space, thus resulting in higher computational cost.
As it can be seen from Fig. 11, the effect of the three parameters on all three algorithms for TD-kNN query is similar under the road network of BJ to that of NY. Specifically, the query time of all solutions on BJ also increases as k increases. Meanwhile, L has little impact on the query time of all algorithms. As for M, our algorithm tends to be stable when M increase, while the other two solutions go down slightly. Overall, TD-H2H is 2-3 orders of magnitude faster than TD-G-tree and TD-Dijkstra in nearly all settings, which verifies the scalability and robustness of our proposed algorithm.

Efficiency of TD-AkNN query
Next, we evaluate the efficiency of the TD-AkNN query. Similar to the ones for the TD-kNN query, we consider the impact of different parameters. Except for the aforementioned four parameters, in the TD-AkNN query, we have one more set of experiment that varies the proportion of occupied objects, i.e., θ . Figure 12 shows the performance results for the TD-AkNN query with three solutions under the dataset of NY. Remarkably, our solution is always superior to the competitors in 3-4 orders of magnitude in all settings. The impacts of k, |L|, and network size are similar to the ones for the TD-kNN query, which shows the robustness of our design framework and the proposed TD-H2H. Differently, the query time of TD-AkNN of three algorithms is very little affected by |M| on both of the maps, as shown in Fig. 12b. The reason is that although the destination of the occupied object is closer to the query point, its current location might be far away. Thus, the impact of object density has little correlation with the road network distance from object to query point. As for θ , Fig. 12e illustrates the query time of the three algorithms under different occupancy rates. For an occupied moving object, to calculate the travel cost to the query point, both the travel time from its current location to its destination and this destination to the query point need to be calculated. Consequently, when we increase the number of occupied moving objects, the overall computational cost increases accordingly.
We also conduct the experimental study of TD-AkNN on the road network of BJ for the three algorithms, and the results are illustrated in Fig. 13. It can be seen that the query time of all solutions increases with the value of k and θ , while it is not greatly affected by |M| and |L|. Similarly, our proposed TD-H2H still performs well in BJ road network, achieving 3-4 orders of magnitude faster against the TD-G-tree and TD-Dijkstra algorithms.

Conclusion
In this paper, we present a comprehensive study on TD-kNN queries, which aims to return k moving objects that can fastest arrive at a given query location departing at time t. We develop an efficient framework derived from the GLAD that includes a novel TD-H2H index for fastest travel cost computation and two pruning strategies to speed up TD-kNN query. We further extend our solution to address the TD-AkNN, where both occupied and non-occupied moving objects are considered. Extensive experiments on the realworld road network show that our solution is several orders of magnitude faster than the competitors. Acknowledgements The research work described in this paper was partially supported by the Natural Science Foundation of Liaoning Education Department under Grant No. LJKZ0205 and was partially conducted in the JC STEM Lab of Data Science Foundations funded by The Hong Kong Jockey Club Charities Trust.

Funding Open Access funding enabled and organized by CAUL and its Member Institutions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecomm ons.org/licenses/by/4.0/.