Research Article | Open Access
Efficient Processing of Moving k-Range Nearest Neighbor Queries in Directed and Dynamic Spatial Networks
A k-range nearest neighbor (kRNN) query in a spatial network finds the k closest objects to each point in the query region. The essential nature of the kRNN query is significant in location-based services (LBSs), where location-aware queries with query regions such as kRNN queries are frequently used because of the issue of location privacy and the imprecision of the associated positioning techniques. Existing studies focus on reducing computation costs at the server side while processing kRNN queries. They also consider snapshot queries that are evaluated once and terminated, as opposed to moving queries that require constant updating of their results. However, little attention has been paid to evaluating moving kRNN queries in directed and dynamic spatial networks where every edge is directed and its weight changes in accordance with the traffic conditions. In this paper, we propose an efficient algorithm called MORAN that evaluates moving k-range nearest neighbor (MkRNN) queries in directed and dynamic spatial networks. The results of a simulation conducted using real-life roadmaps indicate that MORAN is more effective than a competitive method based on a shared execution approach.
Recently, positioning devices such as global positioning system (GPS) have become very popular. The use of navigation systems in automobiles is already widespread and this, together with mobile communications, facilitates new exciting applications [1, 2]. In these systems, points of interest (POIs), for example, hotels, campsites, and fuel stations, provided by online map services are located in a spatial network, and their proximity can be defined by the length, for example, the travel time, of the shortest path connecting them [3, 4]. A k-range nearest neighbor (kRNN) query finds the closest objects to each point inside a query range, as opposed to a query point [5–8]. Figure 1 gives an example of a kRNN query in a spatial network, where a query object is located inside a query region denoted by a rectangle for presentation convenience. Note that the numbers on the arrows in the figure indicate the order of the steps. kRNN queries are widely used in the context of location privacy and location uncertainty in location-based services (LBSs). More specifically, when using a potentially untrusted LBS server, users are reluctant to expose their exact location to the server because of the possibility of privacy leakages [9, 10]. As a result, many privacy-preserving techniques that blur the user location into a spatial region corresponding to query region have been proposed. Indeed, location uncertainty is inherent in LBSs because of the imprecision of the utilized positioning system .
Depending on the query lifetime, a location-aware query can be classified as either a snapshot query or a moving query. A snapshot query returns a result only once, whereas a moving query returns results continuously for a designated period. Existing algorithms focus on evaluating snapshot RNN queries. They primarily consider undirected and static spatial networks where every edge is undirected and its weight does not change over time [5–8]. However, their problem scenarios based on undirected and static spatial networks fail to provide a sufficient level of realism for many applications of interest when query objects move freely and constantly.
In this paper, we present a new approach for evaluating moving RNN queries (MRNN) in directed and dynamic spatial networks where each edge has a particular orientation and its weight changes in accordance with the traffic conditions. Clearly, directed and dynamic spatial network models provide more realistic modeling of urban road networks than undirected and static spatial network models. For example, after entering a highway, a driver must remain on that highway until he/she has reached an exit point, even if he/she has chosen an incorrect path. Thus, a highway can be represented using directed edges. Furthermore, the travel time to a destination selected by a query user frequently changes in accordance with the traffic conditions. In moving objects databases, a safe segment (or safe region) is a popular technique used in the processing of moving queries [11–17]. A safe segment (or safe region) indicates a segment (or region) in which the movement of a query object does not cause the current query result to change. This helps to reduce communication and computation costs.
In this paper, we propose an efficient algorithm, called MORAN, for processing moving k-range nearest neighbor queries in directed and dynamic spatial networks, under the assumption that query objects move freely on spatial networks and that data objects are stationary. In our approach, a query region is partitioned into safe segments, which are maintained in directed and dynamic spatial networks. Clearly, unless the safe segments are used, the query object should evaluate a kNN query at its location using the kRNN query result provided by the server whenever it moves inside the query region. This simple approach places an excessive computational burden on the client side with a high computation frequency. Another considerable approach that can be used to solve this problem is to predict the movement of the query object in order to create the query results beforehand [18, 19]. However, in this paper, we consider a more realistic scenario, in which the query object moves arbitrarily and its path is not known in advance.
The contributions made in this paper can be summarized as follows.(i)We propose a new algorithm called MORAN that partitions query regions into safe segments to facilitate efficient processing of MkRNN queries in directed and dynamic spatial networks.(ii)We also propose a method that preserves the validity of the safe segments when traffic conditions are updated.(iii)We outline extensive experiments conducted to demonstrate the effectiveness and efficiency of MORAN under various conditions.
The remainder of this paper is organized as follows. Section 2 reviews related studies. Section 3 defines the primary terms used in this paper and formulates the research problem. Section 4 presents our proposed method for dividing query regions into safe segments in directed spatial networks. Section 5 presents our proposed method for maintaining the safe segments in dynamic spatial networks. Section 6 analyzes the extensive experimental results obtained. Finally, Section 7 provides concluding remarks regarding the proposed method.
2. Related Work
To ensure location privacy in pervasive computing, mobile users frequently issue kRNN queries using cloaked regions, corresponding to the query regions in this study [5–8, 20]. Then, a server performs query processing, assuming that the user can be at any location inside the query region, and thus not knowing the exact location of the query issuer. Several studies on processing of kRNN queries in Euclidean space have been conducted. Kalnis et al.  developed a new algorithm for computing kRNN queries based on circular regions that reduce the number of redundant results, as well as the communication cost. Chow et al.  proposed a new approximate range NN query processing algorithm that enables the user to tune the tradeoff between the query response time and the quality of the query answers. The algorithm allows the user to specify an approximation tolerance level, where an answer set A is returned such that each object in A is one of the kNNs of every point in the query region. Xu et al.  developed an efficient algorithm for evaluating circular-region-based kNN queries that applies a filter method based on a distance measure to prune out POIs effectively. However, these techniques based on Euclidean distance cannot be applied to our problem concerning network-constrained mobile users and network distance-based queries.
kRNN queries have also been widely studied in the context of privacy-preserving LBSs based on spatial network distance, where the exact location of the query issuer is blurred into the query region [5–8]. The basic idea underlying the processing of a kRNN query is to execute a range query to retrieve data objects within the query region and execute kNN queries at the boundary points of the query region. Ku et al.  developed a privacy-aware spatial network nearest neighbor query algorithm that retrieves all POIs inside a given cloaked region and finds POIs outside the cloaked region using spatial network expansion. Naturally, issuing kNN queries multiple times in order to process kRNN queries leads to a huge redundant search overhead. To rectify this problem, Bao et al.  proposed an efficient kRNN query processing algorithm that employs a shared execution approach to eliminate the redundant search overhead.
Existing algorithms such as [5–8] deal with snapshot kRNN queries as opposed to the moving kRNN queries considered in this study. Consequently, they focus on reducing the computation time of the server as well as communication costs between the server and query objects. Thus, while processing snapshot kRNN queries, existing algorithms do not have to consider the computation time of the query objects that evaluate the exact kNN set using a set of candidate data objects provided by the server. This is because in processing snapshot kRNN queries, the computation time of the query objects is very small compared to the computation time of the server. However, very little research has focused on supporting MkRNN queries in directed and dynamic spatial networks where the computation time of the query objects is not negligible.
Nutanong et al.  developed an incremental safe-region-based technique, called the -Diagram, for answering moving kNN queries in Euclidean space as well as in undirected spatial networks. However, -Diagram is not appropriate in our problem scenarios because the distance is transitive in both Euclidean space and undirected spatial networks, whereas the distance is not transitive in directed spatial networks. Yung et al.  proposed an algorithm for computing the boundary, referred to as safe exits, of the safe region of moving range queries in spatial networks. Their solution focuses on moving range queries (e.g., find gas stations within for the next 10 minutes) and is thus inapplicable for the processing of MkRNN queries.
MORAN differs from existing studies in several aspects: first, it considers MkRNN queries in directed and dynamic spatial networks; second, it focuses on reducing the computation time and frequency of the query object; and finally, it efficiently determines and maintains safe segments within a query region. In recent years, various types of queries on moving objects have also been studied extensively. They include range queries [14, 17], kNN queries with two predicates , and obstructed kNN queries . The associated studies have different problem scenarios from those in our study and their solutions are not appropriate.
Finally, Table 1 compares our problem scenario with related work in terms of query type, space domain, and mobility of query objects and data objects. Because of space limitations, we shorten the terms “undirected and static spatial network” to “USSN” and “directed and dynamic spatial network” to DDSN.
3.1. Definition of Terms and Notations
Now, we define the terms and notations used in this paper for clarification.
Spatial Network. A spatial network is represented by a weighted directed graph , where , , and denote a node set, edge set, and edge distance matrix, respectively. Each edge connecting two nodes has a weight and a specific orientation. The weight of an edge changes depending on the traffic conditions, and its direction is either bidirectional or unidirectional. Specifically, denotes an undirected edge, where and are adjacent nodes, whereas or denotes a directed edge. The arrow above the edge denotes the associated direction.
Classification of Nodes. Nodes can be classified into three categories according to the node degree: (1) if it is greater than or equal to 3, the node is referred to as an intersection node; (2) if it is equal to 2, the node is an intermediate node; and (3) if it is equal to 1, the node is a terminal node.
Edge Sequence and Segment. An edge sequence, denoted by either or , refers to a path connecting two nodes, and , such that (or ) is either an intersection or terminal node, and the other nodes in the path are intermediate nodes. The two end nodes, and , are called boundary nodes. Clearly, all edges in the same edge sequence have the same direction. The length of an edge sequence is the total weight of the edges in the edge sequence. One part of an edge sequence is called a segment. Note that by definition, an edge sequence is also a segment defined by the boundary nodes of the edge sequence.
To simplify the presentation, Notations and Their Definitions summarizes the notations used in this paper. The distance between two points in a directed spatial network is not symmetric; that is, for two points , there is no guarantee that equals . Note that if the algorithms for MORAN operate in the same manner for undirected and directed spatial segments, an undirected segment is used for convenience to describe the algorithms.
Figure 2 depicts the distances and segment length between two objects and in a directed spatial network. In this figure, the shortest path from to is and thus the distance from to is . Conversely, the shortest path from to is and thus the distance from to is . This proves that the network distance is not symmetric in a directed spatial network. The segment connecting and in the same edge sequence becomes and thus its length is . Recall that is defined if and only if the two points, and , are located in the same edge sequence.
3.2. Problem Formulation
Figure 3 shows an example of an MRNN query in a directed and dynamic spatial network. Here, data objects through are represented by the rectangles and a query region is represented by a set of bold line segments; that is, . The boundary point of a query region indicates the point where the query region and nonquery region meet. In this example, query region has four boundary points, through . The number next to an edge indicates the distance between the two adjacent objects. Suppose that a query object in query region requests two NNs from the server, while hiding its location from the server. Then, the kRNN query result for should include the two closest data objects to each point in query region . The query result can be represented by a set of tuples, where is a safe segment in and is the query result for the safe segment . As shown in Figure 3(a), query region can be partitioned into four safe segments; that is, , , , and . Clearly, if query object is located in a safe segment (i.e., ), then the kNN set of is . Similarly, if , then the kNN set of is , if , then the kNN set for is , and if , then the kNN set of is . As shown in Figure 3(b), if the weight of an edge represented by the bold dotted line is updated from 3 to 5 at time , this update may affect the safe segments computed at time , which leads to nullifying the kNN set of .
(a) MkRNN query with and its safe segments at time
(b) Updated traffic conditions at time
The query region consists of a set of segments and a set of boundary points; that is, and . Clearly, a query object is located inside query region , while hiding its exact location from the server to ensure location privacy. Note that we use the terms “query object ” and “query point ” interchangeably for convenience of discussion. Clearly, for a query point , holds, where refers to a set of NNs at a boundary point and refers to a set of objects inside a segment . It should be noted that processing kRNN queries at the server is orthogonal to this study. Therefore, any kRNN query processing algorithms (e.g., [5, 6]) can be used to evaluate the kRNN queries at the server. The server evaluates a kRNN query for a query region and then provides a set of candidate data objects to query object . Finally, determines safe segments using a set of candidate data objects for the query region . Recall that given a safe segment , for two points , is equal to .
Figure 4 illustrates three scenarios that can arise when a query object issues kRNN queries. As shown in Figure 4(a), at time , a query object submits a kRNN query for a query region to the server. On receiving the query, the server evaluates the kRNN query and returns the query result to . Clearly, determines safe segments inside query region using the kRNN query result. As shown in Figure 4(b), when leaves the query region at time , it submits a kRNN query for an updated query region to the server. Then, the server evaluates the kRNN query and returns the query result to . Clearly, determines safe segments inside query region . As shown in Figure 4(c), while is inside at time , a query region overlaps a traffic congestion area , marked by a gray rectangle, in which the weight of the edges changes. The server realizes that the traffic congestion area invalidates the kRNN query result for and thus requests that updates the query region. Consequently, submits a kRNN query for an updated query region to the server, which evaluates the kRNN query and returns the query result to . Clearly, determines the safe segments inside query region . In Section 5, we elaborate on a method to verify that an updated traffic condition invalidates current kRNN query results.
(a) submits a RNN query for a query region to the server at time , where
(b) submits a RNN query for an updated query region to the server when leaves at
(c) Server requests that updates the query region when a set of candidate objects is invalidated at
4. Processing MkRNN Queries in Directed Spatial Networks
In Section 4.1, we give an overview of MORAN. In Section 4.2, we present an algorithm for determining safe segments in a query region. Finally, in Section 4.3, we discuss the construction of the safe segments of an MkRNN query for the example of directed spatial network.
As stated before, we focus on query processing at the client side while processing MkRNN queries in a directed and dynamic spatial network. If either of the two events in Figure 5 occurs, the server should evaluate the kRNN query and provide query object with an updated kRNN query result. The first event is leaving the current query region. For example, as shown in Figure 5(a), if moves to outside of , a kRNN query should be reevaluated with the updated query region. The second event is invalidation of the current kRNN query result provided to query object because of an updated traffic condition. For example, as shown in Figure 5(b), if query region overlaps traffic congestion area , the kRNN query should be reevaluated to reflect the updated traffic condition. When the query object receives an updated kRNN query result from the server, it should reevaluate safe segments inside the query region. Using safe segments reduces the computation time and frequency because the query object does not have to evaluate kNN queries while inside the safe segments.
(a) leaves query region
(b) Congestion area nullifies RNN query result for
Algorithm 1 outlines the process of determining the safe segments in a query region in a directed spatial network. The algorithm starts by initializing to an empty set, which stores the safe segments found thus far. Each segment in query region is explored sequentially to find the safe segments in segment . For this purpose, MORAN evaluates two kNN queries issued at boundary points and of segment . The query results are stored to and , respectively. The objects in are explored and stored to . The function find_safe_segments is called with , , and in order to find safe segments in segment . The found safe segments are added to the result set . When all the segments in have been examined, a set of safe segments in query region is returned to the query issuer. It should be noted that if updates in the weight of edges frequently occur in a spatial network, it is better to determine the safe segments in the current segment including the query point rather than all the safe segments in the query region. We employ a shared execution approach , which is widely used to avoid multiple visits to the same nodes and edges. This clearly reduces the query processing time while determining safe segments in a query region.
4.2. Partitioning Query Region into Safe Segments
We consider an undirected segment followed by a directed segment . We present a method for finding safe segments in segment by using , , and . Here, and refer to sets of NNs at boundary points and , respectively, and refers to a set of objects inside segment . An object that belongs to the union of , , and , that is, , is referred to as a qualifying object. Clearly, the set of NNs at a query point is a subset of the union of , , and [5, 13, 26]; that is, . If equals and is a subset of , segment becomes a safe segment. Otherwise, it has two or more safe segments.
We first explore the change in a network distance for a qualifying object when a query point is located in an undirected segment [13, 14]. Figure 6 shows the change in for three cases: , , and . In this figure, the -axis represents and the -axis represents for . If , then , as shown in Figure 6(a). Similarly, if , then , as shown in Figure 6(b). Finally, if , then , as shown in Figure 6(c).
(a) If , then
(b) If , then
(c) If , then
Table 2 summarizes the evaluation of for and , where MIN returns the minimum of the values in the input array. Because a qualifying object belongs to a combination of , , or , a total of seven possible cases are considered. Note that , , , and are given constants and is the length of the shortest path among multiple paths from and .
Figure 7 shows an example of the change in depending on the location of query point . For simplicity, we assume that the number of NNs requested at query point is . Then, as shown in Figure 7(a), , , and are evaluated as , , and , respectively. As shown in Figure 7(b), the distance from to , represented by the bold lines, is if ; otherwise, it is because , , and are given.
Next, we explore the change in network distance for object when a query point is located in a directed segment . Figure 8 shows the change in for three cases: , , and . Note that the dotted lines indicate that no paths exist from to for the corresponding intervals, which are denoted by . For object , as shown in Figure 8(a), if , then ; otherwise (i.e., ), . Similarly, if , then , as shown in Figure 8(b). Finally, for object , as shown in Figure 8(c), if , then ; otherwise (i.e., ), . Here, is the length of the shortest path from and where query point and is thus determined using Table 2 in the same way as .
Figure 9 shows an example of the change in depending on the location of query point . For simplicity, we assume that the number of NNs requested at query point is . Then, as shown in Figure 9(a), , , and are evaluated as , , and , respectively. As shown in Figure 9(b), the distance from to , represented by the bold lines, is if ; otherwise, it is because , , and are given.
4.3. Partitioning Example Query Region into Safe Segments
We now discuss the construction of safe segments for query region in Figure 3(a). Recall that the number of requested NNs is and the query region includes three segments; that is, . Table 3 summarizes the computation of the safe segments in query region . Clearly, the kNN set at a node is evaluated only once, and it is reused multiple times.
As shown in Algorithm 1, MORAN determines the safe segments for each segment in query region . Therefore, we show the successive determination of the safe segments in , , and . It is clear that adjacent safe segments with the same query result can be merged. Recall that we can draw by using a query point and an object .
Figure 10 depicts using a query point and each object . Here, the union of , , and becomes , because , , and are given. Figures 10(a), 10(b), 10(c), and 10(d) illustrate , , , and , respectively. Recall that , , , and hold.
To partition a segment into safe segments, it is essential to identify the th NN at a query point among the qualifying objects . Algorithm 2 determines the skyline that consists of pairs such that and hold for each query point . The variable count keeps the number of qualifying objects processed thus far, which is initialized to 0 (line (1)). If count is less than , then the skyline for is determined by for , where keeps the th NN determined thus far (lines (4)-(5)). Otherwise (i.e., ), the skyline for is determined by for (lines (6)-(7)). Naturally, count increases by 1 whenever an object o is processed (line (8)).
Figure 11 illustrates the partitioning of a segment into three safe segments using for each object . Figure 11(a) shows the plot of for each object . Note that, to simplify the presentation, the interval in which holds is not represented. When a query point moves in a segment , its th NN is determined using Algorithm 2 and is represented by the bold lines in Figure 11(b). Specifically, for , the th NN is and thus the kNN set is . Similarly, for , the th NN is and thus the kNN set is . Finally, for , the th NN is and thus the kNN set is . Consequently, a segment is divided into three safe segments, represented by .
(a) Plot of for
(b) , ,
Figure 13 illustrates the partitioning of a segment into two safe segments using for each object . Figure 13(a) shows the plot of for each object . When a query point moves in a segment , its th NN is represented by the bold lines in Figure 13(b), where a point marked by a five-pointed star indicates the middle of the segment . Specifically, for , the th NN is and thus the kNN set is . Similarly, for , the th NN is and thus the kNN set is . Consequently, a segment is divided into two safe segments, which are represented as . Finally, a segment becomes a safe segment; that is, . This is because equals and is a subset of ; that is, and .
(a) Plot of for
5. Monitoring Safe Segments in Dynamic Spatial Networks
Figure 14 illustrates an example of changing the weight of an edge in a spatial network where it is assumed that is given. For convenience, we consider the query region that consists of an edge ; that is, . As shown in Figure 14(b), when the weight of an edge has been updated from 3 to 5 at time , this update may invalidate the safe segments in the query region . Therefore, it is necessary to monitor the validity of safe segments in a query region when the change occurs. To this end, we introduce an influential region to monitor the validity of safe segments. The influential region for a query point is defined as a set of points such that holds. If the weight of an edge changes inside influential region , the kNN query at query point should be reevaluated to reflect the change in the weight. However, if the weight of an edge changes outside influential region , the change can be safely ignored. Suppose that a query region is represented by a set of connected segments and a set of boundary points; that is, and . Then, the influential region for query region becomes the union of the influential region for each query point ; that is, . This can be represented simply as , where refers to the influential region at each boundary point of the query region . Specifically, is the set of points such that holds. Here, is the farthest answer object from boundary point ; that is, for each answer object , holds.
(a) Query region at time
(b) Updating the weight of at time
Figure 15(a) illustrates the influential region for the query region at time , where the dotted line and square brackets mark the influential region and its boundary points, respectively. A set of the two NNs at boundary point is and the th NN of is . Thus, the distance from to its th NN is and thus the influential region for a boundary point becomes . Similarly, the influential region for a boundary point evaluates , because , , and