Abstract

nearest neighbor (NN) search is an important problem in  location-based services (LBS) and has been well studied on static road networks. However, in real world, road networks are often time-dependent; i.e., the time for traveling through a road always changes over time. Most existing methods for NN query build various indexes maintaining the shortest distances for some pairs of vertices on static road networks. Unfortunately, these methods cannot be used for the time-dependent road networks because the shortest distances always change over time. To address the problem of NN query on time-dependent road networks, we propose a novel voronoi-based index in this paper. Furthermore, we propose a novel balanced tree, named -, which is a secondary level index on voronoi-based index to make our querying algorithm more efficient. Moreover, we propose an algorithm for preprocessing time-dependent road networks such that the waiting time is not necessary to be considered. We confirm the efficiency of our method through experiments on real-life datasets.

1. Introduction

With the rapid development of mobile devices, nearest neighbor (NN) search on road networks has become more and more important in  location-based services (LBS)[14]. Given a query location and a set of objects (e.g., restaurants) on a road network, it is to find nearest objects to the query location. NN search problem has been well studied on static road networks. However, road networks are essentially  dynamic complex networks but not static in real world [58]. The “dynamic” means that the traveling time on road network is always time-dependent. For example, the Vehicle Information and Communication System (VICS) and the European Traffic Message Channel (TMC) are two transportation systems, which provide real-time traffic information to users. Such road networks are time-dependent; i.e., travel time for a road varies with taking “rush hour” into account.

The existing works propose various index techniques for answering nearest object query on road networks. The main idea behind these indexes is to partition the vertices into several clusters, and then the clusters are organized as a voronoi diagram or a tree (e.g., R-tree, G-tree). All these methods precompute and maintain the shortest distances for some pairs of vertices to facilitate NN query. Unfortunately, these indexes cannot be used for time-dependent road networks. The reason is that the minimum travel time between two vertices often varies with time. For example, and are in the same cluster for one time period but they may be in two distinct clusters for another time period because of the minimum travel time varying with time. Therefore, the existing index techniques based on the static shortest distance cannot handle the case that the minimum travel time is time-dependent. Moreover, the waiting time is allowed on time-dependent road networks; i.e., someone can wait a time period to find another faster path. When the waiting time is considered, it is more difficult to build an index for NN query by existing methods because it is difficult to estimate an appropriate waiting time for precomputing the minimum travel time between two vertices.

Recently, there are some works about NN query on time-dependent graphs [912]. Most of these works utilize A algorithm to expand the road networks by estimating an upper or lower bound of travel time. There are two main drawbacks of these methods. First, in these works, the FIFO (first in first out) property is required for the networks and the waiting time is not allowed. Second, the indexes proposed by these works are based on the estimated value of travel time. However, these indexes cannot facilitate query effectively for large networks because the deviations are always too large between the estimated and the actual travel time.

In this paper, we study nearest object query on time-dependent road networks. A time-dependent road network is modeled as a graph with time information. The weight of every edge is a time function which specifies how much time it takes to travel through the edge if departing at time point . The main idea of our method is to precompute minimum travel time functions (or -function for short) instead of concrete values for some pairs of vertices and then design a “dynamic” voronoi-based index based on such functions. Here “dynamic” means that in a time-dependent network it can be easily decided which cluster a vertex should be in for any given time point . Furthermore, a secondary level index is built on voronoi-based index, which makes our querying algorithm more “smart” for nearest objects searching; that is, the nearest objects will be searched and the others will be filtered as early as possible. Different to previous works, our index can facilitate query effectively for large networks. Moreover, our method does not require the FIFO property for networks and we allow waiting time on every vertex.

The main contributions of this paper are summarized as below. First, we propose an algorithm to process for every edge such that the waiting time is not necessary to be considered. Let and be the original graph and the graph after processing . We can prove that a shortest path with consideration of waiting time on is one-to-one mapped to shortest path without waiting time on . Furthermore, we show how to compute the -function for two vertices. Second, we propose a novel voronoi-based index for time-dependent road networks and an algorithm to answer NN query using our index. Third, we propose a novel balanced tree structure, named -, which can be considered as the secondary level index on voronoi-based index to make nearest object query more efficient. Finally, we confirm the efficiency of our method through extensive experiments on real-life datasets.

The rest of this paper is organized as follows. Section 2 gives the problem statement. Section 3 decribes how to process and compute the -function. Section 4 explains how to build the voronoi-based index for time-dependent networks. Section 5 introduces the - and how to answer the nearest object query using it. The experimental results are presented in Section 6. The related work is in Section 7. Finally, we conclude this paper in Section 8.

2. Problem Statement

Definition 1 (time-dependent road network). A time-dependent road network is a simple directed graph, denoted as (or for short), where is the set of vertices; is the set of edges; and is a set of nonnegative value function. For every edge , there is a time function , where is a time variable. A time function specifies how much time it takes to travel from to , if one departs from at time point .

In this paper, we assume that . The assumption is reasonable, because the travel time cannot be less than zero in real applications. Our work can be easily extended to handle undirected graphs. An undirected edge is equivalent to two directed edges and , where .

There are several works that study how to construct time function , which is always modeled as a piecewise linear function [6, 7, 13] and it can be formalized as follows:

Given a path , the travel time of is time-dependent. In order to minimize the travel time, some waiting time is allowed at every vertex in . That is, when arriving at , one can wait a time period if the travel time of can be minimized. We use and to denote the arrival time at and departure time from , respectively. For each in , we haveLet be a given path with the departure time and the waiting time for each vertex ; then we have

Thus the travel time of path is Given two vertices and in , the minimum travel time from to with departure time is defined as , where is the set of all the paths from to in . Obviously, is also a function related to the departure time . We call the  minimum travel time function (or -function shortly) from to . Letting be , in the following, we use to represent -function from a vertex to an object , in order to distinguish from from to a vertex . Note that an object is also a vertex regarded as in the network.

There is a special case that the waiting time is only allowed on a subset of ; that is, people are allowed to wait a time period only when they are at the vertex . For this case, we only need to consider that the waiting time is always zero, i.e., , for every vertex . Therefore, the method proposed in this paper can be extended to handle this case easily.

Next, we give the definition of NN query over time-dependent road networks.

Definition 2 ( nearest objects on time-dependent road networks). Given a time-dependent road network , a set of the objects , a query point , and a departure time , nearest object query of is to find a -size subset , such that for every object .

3. Minimum Travel Time Function

We precompute -functions for some pairs of vertices and then build the index to facilitate NN query over time-dependent road networks. In this section, we first describe how to process the time function for every edge in such that the waiting time is not necessary to be considered when computing -function and then we explain how to compute -function without waiting time.

3.1. Preprocessing Time Function for Every Edge

Given a path , the waiting time is allowed for any vertex . However, it is not easy to find an appropriate value of for every to minimize the travel time of . In this section, we propose an algorithm to convert time function to a new function for every edge . We call the “no waiting time function” of edge (or -function for short). The waiting time can be considered as zero when -function is used to compute the minimum travel time of path . The -function is defined by the following:

Note that when the waiting time is only allowed on a vertex subset , we only need to calculate -function for every vertex . For every vertex , the -function is exactly the time function because ; that is, anyone is not allowed to wait a time period at .

The following theorem guarantees that the -function can be used to compute the minimum travel time for any path in without waiting time.

Theorem 3. Given two time-dependent graphs and , where is the set of -functions of all edges in , for any path in , the minimum travel time of in with consideration of waiting time equals the minimum travel time of in without waiting time.

Proof. Let be a given path with the departure time . is the waiting time on minimizing the travel time of in . We have and Similarly, we have and for . We only need to prove It can be easily proved by induction on . We omit it due to the space limitation.

The algorithm to compute -function is shown in Algorithm 1. For every , if , Algorithm 1 computes backward from to iteratively. In each iteration, for is computed. Algorithm 1 first sets as , where and . is the minimum value between and . is the left limit value of on . Note that and have been computed in the last iteration; i.e., the iteration for computing on . is initialized as . Next, Algorithm 1 updates as for and then is updated as . The algorithm terminates when has been computed for . Note that if , is computed as immediately.

Input:   and .
Output:  .
1: ;
2: for every   do
3:  if    then
4:   , ;
5:   for to 1do
6:    , ;
7:     for ;
8:    ;
9:    ;
10: else
11:  ;
12: ;
13: return  

The time and space complexities analysis for Algorithm 1 are given below. Let and be the number of the vertices and edges in , respectively. For every edge , Algorithm 1 needs to compute on iteratively from to . For every time interval , can be computed in constant time. Therefore, the time complexity of Algorithm 1 is . Moreover, Algorithm 1 needs to maintain and then the space complexity is also .

Example 4. We illustrate how to compute by an example in Figure 1. As the solid black line in Figure 1(a), is a piecewise linear function:In the first iteration, is initialized as and then . As the dashed red line in the right-side of Figure 1(a), we find that is always less than on , then for , and is updated as . Similarly, in the second iteration, on is computed as , i.e., for and for . Then is updated as . In the final iteration, as the dashed red line in the left-side of Figure 1(a), is alway larger than on , and we have for . Then is given below and depicted in Figure 1(b)).

The following theorem guarantees the correctness of Algorithm 1.

Theorem 5. computed by Algorithm 1 is exactly the -function given by (4).

Proof. We proved it by induction on .
Basis. We need to prove that on time interval can be correctly computed by Algorithm 1. First, can only be zero when ; then we have and . Next, we consider the case of .
By the definiton of , we haveFor , if , cannot decrease with increasing. It means that is minimum when and then . If , will decrease with increasing and thus is minimum when , which is the longest waiting time on for . Then we haveObviously, when and when . Then we have for .
Induction. Assuming that the correct can be computed by Algorithm 1 for , then we need to prove it also can be correctly computed for . We consider the following two cases: (1) and (2) .
For case (1), the departure time because . By the assumption, -function has been correctly computed for ; then is the minimum travel time for edge with departure time . Therefore, for can be computed by the following:For case (2), because , then . Similar to the proof of basis, we haveNote that when , because may be noncontinous at . Therefore, we have The proof is completed.

3.2. Computing Minimum Travel Time Function

We adopt a Dijkstra-based algorithm proposed in [13] to compute -function for two vertices and in . This algorithm is only used in case the waiting time is not allowed. After converting to -function for every edge in by Algorithm 1, this algorithm can be used for time-dependent graphs with waiting time.

The main idea of this Dijkstra-based algorithm is to refine a function iteratively for every , where represents the earliest arrival time on if departing from at time point . In every iteration, algorithm selects a vertex and then refines by extending a time domain to a larger , where is a subinterval of the whole time domain . is regarded as well refined in if it specifies the earliest arrival time at from for any departure time . The algorithm repeats time-refinement process till of destination has been well refined in the whole time domain and then -function can be computed as . The more details about this Dijkstra-based algorithm is given in [13]. As shown in [13], the time and space complexities are and , respectively, where is the cost required for each function (defined in interval ) operation.

4. The Novel Voronoi-Based Index

We propose a novel voronoi-based index for NN query over time-dependent road networks. In static road networks, the voronoi diagram divides the network (or space) into a group of disjoint subgraphs (or subspaces) where the nearest object of any vertex inside a subgraph is the object generating this subgraph. However, in time-dependent road networks, the nearest object of a vertex may be dynamic. The nearest object of a vertex may be for departure time but it may be for . The main idea of our novel voronoi-based index is also to divide the vertex set into some vertex subsets and every subset is associated with one object . Different from static road networks, our voronoi-based index is time-dependent; that is, every vertex inside a subset is with a time interval indicating when the object is nearest to . Next, we describe what the novel voronoi-based index is and how to construct it.

4.1. What Is the Voronoi-Based Index?

Given a vertex and an object , is called ’s about if it satisfies the following two conditions: (1) is the nearest object of for any departure time and (2) there does not exist another satisfying the condition (1). Note that may not be a continuous time interval; that is, if is nearest to for two disjoint departure time intervals and , then . The voronoi-based index maintains a set for every object , where is a set of the tuples for all the vertices with nonempty , i.e., We call the  closest vertex-time pair set (or closest pair set shortly) of . For simplicity, we say is a vertex in if . Next, we give the definition of the border vertex.

Definition 6 (border vertex). A vertex in is called a  border vertex of if there exist such that for any , where is the outgoing neighbor set of and is the time interval mapped from by the function .

The border vertex of indicates that there exists a time point such that is not the nearest object of if one departs at time point .

We use to denote the set of all the border vertices of . For every , is the set of -functions for all vertices in , that is,and is a matrix of size to maintain -function for all pairs of vertex and border vertex in , i.e.,The voronoi-based index is , where , , , and are the collections of all , , , and , respectively.

4.2. How to Construct The Voronoi-Based Index?

We have explained how to compute -function in Section 3. Next, we describe how to compute and for every .

For every vertex , is initialized as the whole time domain . We refine iteratively by removing the subintervals on which is larger than for another object . It means is not the nearest object of when departure time is in these subintervals. For every , let denote the maximum time interval on which and is updated as . After removing for every other object , if is not empty, then the pair is inserted into .

For every vertex in , if there exists an outgoing neighbor of , such that is not in or , then must be a border vertex of and it is inserted into .

4.3. Query Processing by Voronoi-Based Index

Algorithm 2 describes how to find the nearest objects for a query vertex with departure time . In Algorithm 2, is a set to maintain the objects that have been found so far and is a priority queue to maintain a candidate set of whose is possible to be an object in NN set. All are sorted in an ascending order by the minimum travel time from to . The top in is with the minimum and it can be easily done using Fibonacci Heap. and are initialized as and , respectively, where contains for the departure time , i.e., and . is expanded iteratively by inserting objects one by one from until . In each iteration, if , Algorithm 2 first dequeues the top from with the minimum . The object of must be one of nearest objects of . It can be guaranteed by Theorem 8. Then will be inserted into . For every border vertex in , Algorithm 2 computes as , where is the entry set of . The “entry” means any path entering into must go through a vertex in . will be updated when Algorithm 2 runs. For every , if , then will be updated as . Next, if is in ( and ) at the time point , then will be inserted into as an entry of . For the object of , will be updated as when . If is not in , then will be enqueued into . Otherwise, has been in and will be updated by with new . Algorithm 2 terminates when the size of is .

Input: time-dependent graph , query vertex , departure time and
Output: the nearest neighbor set
1: , ;
2: while    do
3:   DEQUEUE (), ;
4:  foreach    do
5:   foreach    do
6:    ;
7:   foreach    do
8:    if    then
9:     ;
10:    Let be the set including when ;
11:    if    then
12:    ;
13:    if    then
14:     ;
15:     if    then
16:      ENQUEUE;
17:     else
18:      UPDATE;
19: return  

Example 7. We use the example in Figure 2 to illustrate the NN querying process for . In this example, is the query vertex and it is in for the departure time . and are initialized as and , respectively. In the first iteration, is dequeued from and then is inserted into . Because is a border vertex of and is an outgoing neighbor of , Algorithm 2 computes and . Note that is in when and then it is an entry of . Therefore, is enqueued into . Similarly, is also enqueued into and . Assume that is nearer to than and, in the second iteration, is dequeued and is updated as . In the same way, will be enqueued into in this iteration. In the final iteration, will be dequeued due to being nearer to and then . Because , Algorithm 2 terminates and returns .
The next theorem guarantees the correctness of Algorithm 2.

Theorem 8. In Algorithm 2, the object of dequeued from in the -th iteration must be the -th nearest object of query vertex for the departure time .

Proof. We prove it by induction on .
Basis. Obviously, is dequeued from in the first iteration. By the definition of , is the nearest object of when the departure time is .
Induction. Assume that the -th nearest neighbor of is dequeued from in the -th iteration for . We need to prove it also holds for . We prove it by contradiction. Let be the closest pair set dequeued from in the -th iteration and is the object of . Suppose that the -th nearest object of is and . Let be the shortest path from to with the departure time . Because , then is not and there must exist an entry of in . Letting be the predecessor of in , then must be a border vertex of at time points and . There are two cases for the object of : (1) is not in the nearest object set of and (2) is in the nearest object set of .
For case (1), by the definition of , is the nearest neighbor of at time point , and then we haveThus is nearer to than when the departure time is . It means must be in the nearest object set of , which is a contradiction.
For case (2), letting be the -th () nearest object of , by the inductive assumption, is dequeued from in -th iteration. According to Algorithm 2, is enqueued into in this iteration. Therefore, will be dequeued from in -th iteration instead of , which is a contradiction. The proof is completed.

Time and Space Complexities. The time and space complexities of Algorithm 2 are given below. Let and be the average size of and , respectively. In every iteration, Algorithm 2 upadates as for every border vertex in . It will cost time. For every outgoing neighbor of border vertex , Algorithm 2 needs to compute and then it will cost time, where is the average outdegree of the vertices in . Therefore, the time complexity of Algorithm 2 is . On the other hand, because Algorithm 2 needs to maintain and , then the space complexity is .

5. Optimization of Voronoi-Based Index

In Section 4, we introduce the voronoi-based index on time-dependent graphs and propose Algorithm 2 to find the nearest objects with voronoi-based index. Algorithm 2 dequeues the objects iteratively until all nearest objects have been searched. In each iteration, Algorithm 2 uses a prior queue to maintain a candidate set of whose object may be one of the nearest objects. This candidate set is essentially the set of all the closest pair sets adjacent to all the objects which have been searched in . However, for some closest pair set of , even though are not one of nearest objects, Algorithm 2 also needs to maintain in and update the traveling time to and the border vertices in because is adjacent to an object in . It makes our algorithm not efficient enough for nearest object query.

In this section, we propose a novel balanced tree structure on voronoi-based index, named -, to organize all the closest pair sets . - can be considered as a secondary level index for nearest object query. By -, our algorithm can avoid maintaining the closest pair sets whose objects are not in the set of nearest objects. The main idea of - comes from -, which is a balanced tree structure, proposed in [14]. - cannot be used for nearest object query on time-dependent graphs because of the following reasons:(1)- is built on the static graphs where the weight of every edge is a constant value. However, for time-dependent graphs, the weight on every edge is a time function which is related to the departure time . The value of always changes with the change of departure time. Therefore, it is unfeasible to construct - for time-dependent graphs.(2)- organizes all the vertices in a tree shape based on the distance of two vertices in a static graphs. Different from -, - is a second-level index based on voronoi-based index. It organizes all the closest pair sets in a tree shape. Therefore, we need to define the distance between two closest pair sets and and then - can be constructed.(3)Because of above two points, the querying algorithm by - cannot work for our problem; then we propose a novel querying algorithm by -.

In the following, we first introduce what is - and how to construct it based on voronoi-based index. Then we propose a novel querying algorithm for nearest object query by -. Finally, we utilize an example to explain why - is more efficient than voronoi-based index.

5.1. What Is V-Tree

- is a balanced tree structure to organize all the closest pair sets in voronoi-based index. Specifically, every node in - is a collection of some closest pair sets. We first give the definition of -partition for voronoi-based index.

Definition 9 (-partition for voronoi-based index). Given a collection of some closest pair sets, a -partition of is a set satisfying three following conditions: (1) ; (2) ; (3) .

Note that every is a subset of and it is also a collection of closest pair sets. Every node in - represents a collection and has children by -partition on ; i.e., every is a child of . Next, we introduce how to get an appropriate -partition for a given closest pair set . An edge is called a  crossing edge from the closest pair sets to if and are the border vertices of and , respectively, i.e., and . As our discussion in Section 2, the time function of a crossing edge is modeled as a piecewise linear function . We define the  expected traveling time   for a crossing edge by the following: where is the whole time interval for time function , i.e., . Because is a piecewise linear function, can be calculated as follows:Note that the expected traveling time is a constant value to estimate the traveling time for crossing edge . Given two closest pair set and , we use to denote set of all the crossing edges from to , i.e., . Every closest pair set can be regarded as a super vertex and there is an edge from to if . The weight of such edge, denoted as , is defined by the following: It is worth noting that is the average value of the expected traveling time for all the crossing edge from to . is called the weight from to . Therefore, the -partition for a given collection of some closest pair sets can be converted into a graph partition problem. For a pair of with , if and are in the same collection , then it is called an  inner edge of . Otherwise, and are in two different collections and , respectively, and then it is called an  interedge from to . Correspondingly, the weight is called  inner weight or  interweight, respectively.

In -, a parent node is partitioned into children nodes . To facilitate nearest object query, an appropriate partition is expected such that the inner weights are less and the interweights are more. Thus the optimal -partition is to find a group of that minimizes the following objective function:where is the summation of all the inner weights in and is the summation of for all . The optimal -partition on is similar to the traditional graph partition problem which has been well studied [1517]. However, the objective function is to minimize the sum of the interweights for the traditional graph partition. Therefore, for any pair in , if , we assign a new weight on it, where represents the maximum weight for all the inner edges in . Consider the following objective funtion: where is the summation of for all the inter edges from to and is the summation of for all the pairs of and . The following theorem guarantees that the optimal -partition under objective functions and is the same.

Theorem 10. The -partition minimizing is exactly the -partition minimizing .

Proof. Given a -partition on , let denote the summation of all the inter weights from to , that is, , and then we haveBecause is independent of -partition on , then minimizing is equivalent to maximizing . On the other hand, because and , then maximizing is equivalent to minimizing . Therefore, the -partition minimizing the objective function also minimizes the objective function .

Thus the optimal -partition under objective function is a traditional graph partition problem. In this paper, we adopt the multilevel graph partitioning technique (METIS) proposed by Metis et al. in [15], which is a classic graph partition algorithm.

Next, we introduce the concept of the  minimum distance, which is to be maintained in -. For two closest pair set and , if , we defined the  minimum weight from to , denoted as , by the following:where is a crossing edge from to and is the minimum value of time funtion . Thus is the minimum value of for all the crossing edge in . A new graph can be constructed from the voronoi-based index; every closest pair set can be regarded as a super vertex. If , there is an edge from to and its weight is . Therefore, for any two and , the shortest distance from to in this graph is called the  minimum distance from to and we denote it by . Especially, for a closest pair set and a collection , the minimum distance from to is denoted by and is the minimum value of for all in , i.e., . The value of can be calculated easily by existing single-source shortest distance algorithm. Note that when . Next, we give the definition of - below.

Definition 11 (V-tree). A -, denoted as , is a balanced tree that satisfies the following conditions: (1)Every node in - represents a collection of some closest pair sets. Specially, the root node represents the collection of all the closest pair sets in voronoi-based index;(2)Every nonleaf node has children . All these children consist of the optimal -partition on .(3)Every leaf node has at most closest pair sets.

In -, every leaf node is associated with a matrix to maintain the minimum distance from every closest pair set in leaf node to every node in -, i.e.,where and are different nodes in . It is because and then . Note that if is an ancestor in , we also have directly.

Example 12. Figure 3 illustrates an example of -partition on a voronoi-based index. The corresponding - is shown in Figure 4. In this example, is the collection of all the closest pair set and it is partitioned into . Thus and are two children of in -. Similarly, and are two children of . and are two children of . Because , , , and are four leaf nodes of -, then every one of them is associated with a minimum distance matrix. For example, is a closest pair set in and the minimum distance from to every node in is stored in the matrix associated with . In Figure 4, every matrix maintaining the minimum distance is presented next to every node in -.

5.2. How to Construct V-Tree

Algorithm 3 describes how to constrcut a -   for a given collection of all the closest pair sets in a voronoi-based index. To construct -  , Algorithm 3 utilizes a queue to dequeue the nodes in iteratively and expand the children for every node until - has been constructed. Both and are initialized as , where is the collection of all the closest pair set in voronoi-based index. In each iteration, a node is dequeued from . If , is a nonleaf node and then Algorithm 3 calls function PARTITION () to get the optimal -partition on . Note that is the number of the closest pair sets in and PARTITION () is the implementation of METIS algorithm. Assume that the output of PARTITION () is , which will be inserted into as the children set of . Next, Algorithm 3 enqueues every child of into . Note that if , node is a leaf node in and Algorithm 3 will dequeue next top element in . When is empty, the structure of -   has been constructed. Finally, for each leaf node in , Algorithm 3 calculates the minimum distance matrix and associates it with the leaf node . Therefore, - is constructed and returned.

Input: a collection of all the closest pair sets in voronoi-based index, ,
Output:  -tree
1: , ;   /  -tree only have one node as its root /
2: while    do
3:   DEQUEUE ();
4:  if    then
5:    PARTITION ();
6:   inserts into as the children of ;
7:   for each () do
8:    ENQUEUE;
9: for each leaf node in   do
10: calculates and maintains it on ;
11: return  

Example 13. We use the example in Figure 3 to show how to construct - in Figure 4. In this example, and . At the beginning, and are initialized as ; is the collection of all the closest pair set in Figure 3. In the first iteration, the root node is dequeued from , because and is partitioned into and . Then and are inserted into as two children of . Next, and are enqueued into . In second and third iteration, and are dequeued from , respectively. and are inserted into and enqueued into . Algorithm 3 dequeues , , , and one by one. Finally, the minimum distance matrices on , , , and are, respectively, computed and maintained in -  . Thus the - shown in Figure 4 has been constructed.

Space Complexity of V-Tree. The space complexities of - are given below. Let denote the height of a -. Obviously, , where is the number of objects in . For the -th level of , there are at most nodes. Thus the number of nodes in a -   isFor each leaf node in , a matrix is used to maintain the minimum distance from every closest pair set to every node . The size of every matrix is . Because there are at most leaf nodes in , then the space complexity of is .

For the time complexity of - construction, Algorithm 3 needs to compute -partition using existing partition algorithm for every nonleaf nodes in . We use to denote the time complexity of -partition on all the closest pair sets in voronoi-based index. Therefore, constructing the structure of needs time. For every leaf node in , the minimum distance needs to be calculated. The minimum distances from one to all other can be calculated by single-source and multidestination shortest path algorithm, which can be done in time. Then the time complexity for every matrix on leaf node is . Therefore, the time complexity of - construction is .

5.3. Query Processing with V-Tree

In this section, we propose an efficient algorithm for searching nearest objects by -. The pseudocode is shown in Algorithm 4. The same as Algorithm 2, is a set of the objects that have been found up to now. Different from Algorithm 2, Algorithm 4 needs two priority queues and , where is used to maintain some closest pair sets whose is possible to be one of nearest objects and is used to maintain some nodes of -. All in are sorted in an ascending order by the minimum travel time from to . All in are sorted in an ascending order by the minimum distance . Initially, , , and . In each iteration, Algorithm 4 first considers the top elements in and, in , there are two cases: (1) and (2) .

Input: query vertex , departure time and
Output: the top-k nearest neighbor set
1: , , ;
2: while   and   do
3:  let and are the top elements in and respectively;
4:  if    then
5:    DEQUEUE (), ;
6:   ;
7:   for each   do
8:    if   or   then
9:     updates ;
10:  for each   do
11:   if   has an entry vertex connected to a border vertex in   then
12:    updates ;
13: else
14:   DEQUEUE ();
15:  if   is a non-leaf node in   then
16:   for each   do
17:    ENQUEUE;
18:  else
19:   for each   do
20:    ENQUEUE;
21: return  

For case (1), is dequeued from with ; the object of must be one of nearest objects of . It can be guaranteed by Theorem 14 and then will be inserted into . Let denote the set of the border vertices for all whose , i.e., . Algorithm 4 first updates by and then updates the value of for any if or is an outgoing neighbor of , . Next, Algorithm 4 updates for any by the border vertices in , if has an entry vertex connected to a border vertex in . The order of in is also be updated when changes. The process for updating and is the same as that in Algorithm 2. Note that in Algorithm 2, when is dequeued, all for its neighboring are needed to be updated, but for Algorithm 4, only some neighboring are needed to be updated. Therefore, in each iteration, Algorithm 4 only needs to update for a small number of in which are a subset of the closest pair sets to be updated in Algorithm 2.

For case (2), is dequeued from . If is a nonleaf node in -, the children of will be inserted into with the minimum distance . Note that is maintained in the leaf node containing in -. If is a leaf node in -, every closest pair set will be enqueued into with . Algorithm 4 calculates by the following: Note that the process to calculate is as the same as that in Algorithm 2.

Algorithm 4 terminates when the size is . It means that nearest objects of query vertex have been found.

Theorem 14 guarantees the correctness of Algorithm 4.

Theorem 14. In Algorithm 4, the object node inserted into at the -th time must be the -th nearest object of query vertex for the departure time .

Proof. Similar to the proof of Theorem 8, we prove it by induction on .
Basis. Obviously, the object node in is the first object node inserted into . By the definition of and , we know that is indeed the nearest object of for the departure time .
Induction. Assume that the -th nearest neighbor of is inserted into the result set at the -th time for . We need to prove it also hold for . We prove it by contradiction. It can be known that the object node inserted into at the -th time is the object node that dequeued from the priority queue at the -th time. Let be the closest pair set dequeued from at the -th time. Suppose that the -th nearest object of is and . Let be the shortest path from to with the departure time . Because , is not and there must exist an entry of in . Let be the predecessor of in ; then must be a border vertex of at time points and . Obviously, for the object node of , (1) is not in the nearest object set of and (2) is in the nearest object set of .
For case (1), it is similar to this case in Theorem 8;
For case (2), it is assumed that is the -th () nearest object of . According to Algorithm 4, we know that will be updated, when is inserted into . At this point, will be updated by if is in . Otherwise, will be updated by when is enqueued in . So will be dequeued from at -th time with an accurate , which is a contradiction. The proof is completed.

Time and Space Complexities. We first analyze the time complexity of Algorithm 4. For processing priority queue , the time complexity is the same as Algorithm 2 in the worst case. For processing priority queue , all nodes in will be dequeued in the worst case; then the time complexity is . Therefore, the time complexity of Algorithm 4 is . Next, we analyze the space complexity, the same as Algorithm 2; the space complexity of Algorithm 4 is .

5.4. Effectiveness of V-Tree

We use the example in Figure 3 to show Algorithm 4 with - being more efficient than Algorithm 2 without -. For this example, we set , , and . The red five-pointed star represents the query vertex which is in for the departure time . The minimum distance from to every object is shown in the table in Figure 3.

For Algorithm 2, is initialized as . In the first iteration, is dequeued from . Because , , and are three neighboring closest pair set of , Algorithm 2 will update their and then enqueue them into . Similarly, in the second iteration, is dequeued from . and are enqueued into . will be dequeued from in the final iteration. Note that for the object in will be updated twice in the first and second iteration, respectively; this is because is the neighboring closest pair set of both and . Therefore, Algorithm 2 needs to update for five times in the whole querying process.

For Algorithm 4 by -, and are initialized as and , respectively. When is dequeued from , ,, and are enqueued into . Note that ; then Algorithm 4 does not need to update for , , and . In the following iterations, Algorithm 4 will dequeue , , and from one by one. This is because for the top element in , is always larger than for , , and which are the top elements in . When is dequeued from , is updated and is enqueued into . Similarly, will be updated and will be enqueued into . When is dequeued from , Algorithm 4 terminates and it only needs to update twice in the whole querying process, which is obviously more efficient than Algorithm 2.

Next, we give the following theorem to guarantee that the Algorithm 4 with - is at least as good as Algorithm 2.

Theorem 15. The number of updating for all the closest pair sets in Algorithm 4 is no more than that in Algorithm 2.

Proof. In each iteration, for Algorithm 2, when is dequeued, all for its neighboring are needed to be updated. Obviously, for Algorithm 4, it only needs to update for a small number of in which are a subset of the closest pair sets to be updated in Algorithm 2. So the number of updating for all the closest pair sets in Algorithm 4 is no more than that in Algorithm 2.

6. Experiements

We compare our - method (marked as VT) and voronoi-based index method (marked as VI) with FTTI (Fast-Travel-Time Index) method [11] and TLNI (Tight-and-Loose-Network Index) method [9] on the real-life datasets. FTTI and TLNI are the state of the art index-based methods for NN query over time-dependent road networks. Note that FTTI and TLNI are used on in which every edge is an -function because FTTI and TLNI do not allow the waiting time. Although some algorithms are proposed in recent works [5, 10], they are only to find the nearest object (i.e., ) and they cannot be used for general NN query on time-dependent graphs. All the experiments are conducted on a 2.6GHz Intel Core i7 CPU PC with the 16GB main memory, running on Windows 7.

6.1. DataSets and Experiment Setup

We tested the voronoi-based index method on California road network (CARN) (http://snap.stanford.edu/data/roadNet-CA.html) with 196,5206 vertices and 553,3214 edges. We extracted five time-dependent graphs with different size using the CARN dataset. The number of vertices ranges from 100k to 500k. The time domain is set as ; i.e., the departure time can be selected from for any vertex. Here, 2000 means 2000 time units. For every , we split the time domain to subintervals and assign a linear function randomly for every subinterval and then is a piecewise linear function.

6.2. Experienmental Results

Exp-1. Impact of Network Size. In this group of experiments, we study the impact of time-dependent network size. The number of the vertices increases from 100k to 500k and the number of objects is fixed at 10k. We investigate the querying time for . The number of piecewise intervals of is set as . As shown in Figures 5(a) and 5(b), the querying time of our method is always less than FTTI and TLNI. Note that our - method has the minimum querying time. Specifically, the querying time of TLNI is always much more than our methods even though TLNI has the smallest index size. The reason TLNI index only maintains the vertices for an object is that the upper bound of travel time to is less than the lower bound to the other objects. It cannnot facilitate query effectively in large networks.

Exp-2. Impact of Object Set Size. In this group of experiments, the number of the vertices is fixed at 100k and the number of objects ranges from 10k to 50k. As shown in Figures 6(a) and 6(b), the querying time of our methods is always less than FTTI and TLNI. The querying time decreases with the increasing of the object set size. There are two reasons as follows: (1) the average size of and decreases if the object set size increases; (2) the increasing of object size results in that the objects become nearer to and then querying time decreases. The index size for VI, FTTI, and TLNI decreases with increasing of the object size. But for -, the index size increases with the object size increasing. This is because more objects result in more nodes in -.

Exp-3. Impact of the Time Domain. In Figure 7, we study the impact of time domain. In this group of experiments, the number of vertices and objects is fixed at 100k and 10k, repectively. The time domain ranges from to . We investigate the querying time for . As shown in Figures 7(a) and 7(b), the querying time and index size of our methods are not affected by the expanding of time domain. However, for FTTI and TLNI, the querying time increases with the the expanding of time domain. This is because they need to maintain the estimated value about travel time in index to facilitate NN query. If the time domain becomes larger, the deviation between the estimation and the actual travel time will become larger too. It cannot facilitate query effectively.

Exp-4. Impact of the Number of Piecewise Intervals. In Figure 8, we investigate the impact of the number of piecewise intervals of . In this group of experiments, the number of piecewise intervals of increases from 2 to 10. The numbers of the vertices and objects are fixed at 100k and 10k, repectively. As shown in Figures 8(a) and 8(b), the querying time and index size always increase with the increasing of the number of piecewise intervals. The reason is that the more piecewise intervals of , the more piecewise intervals of -function and then the more border vertices maintained in the index.

Exp-5. Impact of the Average Distance to Objects. The impact of the average distance to objects is shown in Figure 9. In this group of experiments, the number of vertices is set as 100k and 500k, respectively. The number of objects is fixed at 10k and . The average distance to objects ranges from to . Note that the distance means the hops from the query vertex to an object. As shown in Figures 9(a) and 9(b), the querying time increases marginally with the increasing of distance. Our methods are always better than FTTI and TLNI.

Exp-6. Impact of k. In Figure 10, we study the querying time by varying from to on two different networks with 10k vertices and 50k vertices, respectively. In this group of experiments, the number of objects is fixed at 10k and 50k for two different networks, respectively. As shown in Figures 10(a) and 10(b), the querying time always increases marginally with the increasing of for our index method.

Exp-7. Impact of and . In Figure 11, we investigate the impact of the and for -. In this group of experiments, the numbers of the vertices and objects are fixed at 100k and 10k, repectively. The values of and are selected from and , respectively. The experimental results shows the effectiveness of - is the best when . The querying time increases with the increasing of . But the index size increases with the decreasing of . The index size is not affected by varying.

NN query has been well studied on static road networks. Most of the existing works propose various index techniques. The main ideas of these methods are to partition the vertices into several clusters, and then the clusters are organized as a voronoi diagram or a tree (e.g., R-tree) [14, 1825]. These methods precompute and maintain the shortest distances for some pairs of vertices to facilitate NN query. Unfortunately, these index techniques cannot be used for the time-dependent road networks because the minimum travel time between two vertices always varies with time. NN query has also been studied on time-dependent road networks [912, 26]. Most of these works are based on A algorithm. The authors in [5, 10] study the problem to find nearest (i.e., ) object on time-dependent networks. In [10], a virtual node is inserted into the graph with the zero-cost edges connecting to all the objects. The nearest object can be found on the shortest path from the query vertex to . The authors in [27] study the problem of finding POIs that minimize the aggregated travel time from a set of query points. The index-based methods are proposed in [9, 11]. In [9], a algorithm is utilized to expand the road networks by estimating an upper or lower bound of travel time. An index is built to facilitate NN query using these estimated bounds. In [11], time domain is divided to several subintervals. For every subinterval, nearest objects of every vertex are found by an estimation of minimum travel time. There are two main drawbacks of these methods. First, in these works, the FIFO (first in first out) property is required for networks and waiting time is not allowed. Second, the indexes proposed by these works are based on the estimated value of travel time. However, these indexes cannot facilitate query effectively for the large networks because the deviations are always too large between the estimated and the actual travel time.

Recently, there are some works about the shortest path query between two given vertices over time-dependent graphs [13, 2833]. However, these works do not study any index that can be used in NN query over time-dependent road networks. Note that, in [32, 33], the waiting time is incorporated in arrival function which represents the earliest arrival time for every vertex when the departure time is . Different to these works, we propose -function to represent the minimum traveling time for every edge when the waiting time is allowed. The arrival function cannot be utilized in our voronoi-based index for nearest objects problem. Otherwise, the intuitive meaning behind is more easily comprehended than .

8. Conclusion

In this paper, we study the problem of nearest object query on time-dependent road networks. We first give an algorithm for processing time-dependent road networks such that the waiting time is not necessary to be considered and then propose a novel voronoi-based index to facilitate NN query. We explain how to construct the index and complete the querying process using our index. Furthermore, we propose a novel balanced tree, named -, which is a secondary level index on voronoi-based index to make our querying algorithm more efficient. We confirm the efficiency of our method through extensive experiments on real-life datasets.

Data Availability

The road network dataset used to support the findings of this study is included within the article. It can be downloaded from http://snap.stanford.edu/data/roadNet-CA.html.

Additional Points

Different to our previous work published on APWeb-WAIM 2018, in this paper, we propose a novel balanced tree structure, named V-tree, which can be considered as a secondary level index on the voronoi-based index to make nearest object query more efficient.

Disclosure

An early version of this work has been published in the 2nd Asia-Pacific Web (APWeb) and Web-Age Information Management (WAIM) Joint International Conference on Web and Big Data (APWeb-WAIM 2018).

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This work is supported by the National Natural Science Foundation of China Grant nos. 61402323, 61572353, and U1736103, the Opening Project of State Key Laboratory of Digital Publishing Technology, and the Australian Research Council Discovery Grant DP130103051.