Analysis and Applications of LocationAware Big Complex Network Data
View this Special IssueResearch Article  Open Access
Yajun Yang, Hanxiao Li, Junhu Wang, Qinghua Hu, Xin Wang, Muxi Leng, "A Novel Index Method for K Nearest Object Query over TimeDependent Road Networks", Complexity, vol. 2019, Article ID 4829164, 18 pages, 2019. https://doi.org/10.1155/2019/4829164
A Novel Index Method for K Nearest Object Query over TimeDependent Road Networks
Abstract
nearest neighbor (NN) search is an important problem in locationbased services (LBS) and has been well studied on static road networks. However, in real world, road networks are often timedependent; 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 timedependent road networks because the shortest distances always change over time. To address the problem of NN query on timedependent road networks, we propose a novel voronoibased index in this paper. Furthermore, we propose a novel balanced tree, named , which is a secondary level index on voronoibased index to make our querying algorithm more efficient. Moreover, we propose an algorithm for preprocessing timedependent road networks such that the waiting time is not necessary to be considered. We confirm the efficiency of our method through experiments on reallife datasets.
1. Introduction
With the rapid development of mobile devices, nearest neighbor (NN) search on road networks has become more and more important in locationbased services (LBS)[1–4]. 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 [5–8]. The “dynamic” means that the traveling time on road network is always timedependent. For example, the Vehicle Information and Communication System (VICS) and the European Traffic Message Channel (TMC) are two transportation systems, which provide realtime traffic information to users. Such road networks are timedependent; 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., Rtree, Gtree). 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 timedependent 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 timedependent. Moreover, the waiting time is allowed on timedependent 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 timedependent graphs [9–12]. 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 timedependent road networks. A timedependent 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” voronoibased index based on such functions. Here “dynamic” means that in a timedependent 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 voronoibased 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 onetoone mapped to shortest path without waiting time on . Furthermore, we show how to compute the function for two vertices. Second, we propose a novel voronoibased index for timedependent 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 voronoibased index to make nearest object query more efficient. Finally, we confirm the efficiency of our method through extensive experiments on reallife 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 voronoibased index for timedependent 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 (timedependent road network). A timedependent 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 timedependent. 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 timedependent road networks.
Definition 2 ( nearest objects on timedependent road networks). Given a timedependent 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 timedependent 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 timedependent 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.

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 rightside 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 leftside of Figure 1(a), is alway larger than on , and we have for . Then is given below and depicted in Figure 1(b)).
(a)
(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 Dijkstrabased 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 timedependent graphs with waiting time.
The main idea of this Dijkstrabased 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 timerefinement 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 Dijkstrabased 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 VoronoiBased Index
We propose a novel voronoibased index for NN query over timedependent 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 timedependent 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 voronoibased 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 voronoibased index is timedependent; 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 voronoibased index is and how to construct it.
4.1. What Is the VoronoiBased 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 voronoibased 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 vertextime 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 voronoibased index is , where , , , and are the collections of all , , , and , respectively.
4.2. How to Construct The VoronoiBased 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 VoronoiBased 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 .

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 VoronoiBased Index
In Section 4, we introduce the voronoibased index on timedependent graphs and propose Algorithm 2 to find the nearest objects with voronoibased 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 voronoibased 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 timedependent 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 timedependent 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 timedependent 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 secondlevel index based on voronoibased 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 