Tree Index Nearest Neighbor Search of Moving Objects along a Road Network

With the widespread application of location-based service (LBS) technology in the urban Internet of Things, urban transportation has become a research hotspot. One key issue of urban transportation is the nearest neighbor search of moving objects along a road network. The fast-updating operations of moving objects along a road network suppress the query response time of urban services. Thus, a tree-indexed searching method is proposed to quickly find the answers to user-defined queries on frequently updating road networks. First, a novel index structure, called the double tree-hash index, is designed to reorganize the corresponding relationships of moving objects and road networks. Second, an index-enhanced search algorithm is proposed to quickly find the k-nearest neighbors of moving objects along the road network. Finally, an experiment shows that compared with state-of-the-art algorithms, our algorithm shows a significant improvement in search efficiency on frequently updating road networks.


Introduction
The rapid development of mobile communication and spatial positioning technology has extensively promoted the rise of location-based services (LBS). The LBS promotes the vigorous development of user-centric applications on urban transportation, and there has been widespread research in user recommendation systems and road network searching.
One key issue of urban transportation is the nearest neighbor search of moving objects along a road network. However, the fast-updating operations of moving objects along a road network hinder the query response time of urban services. Currently, it is still difficult to quickly find the answers to user-defined queries on a frequently updating road network. Thus, an index-enhanced search algorithm is proposed to accelerate the response time to user-defined queries.
The response problem faced by user-defined queries on a road network is generalized as a k-nearest neighbor search problem (k-NN searching). Research on the k-NN problem in road networks has societal and commercial value [1].
For example, when someone uses the Meituan errand business, the system will send the order information to multiple salespersons nearest the user. Furthermore, k-NN technology promotes the improvement of mobile travel software, such as Didi and Uber, which frequently dispatches vehicles nearest to requesting users. Figure 1 shows a simple example of a k-NN problem, which is a snapshot at time t. Assuming that k = 4, and there exists a user-defined query point q at time t, then, 4-NN searching can be conducted with different calculation strategies. Considering only the pairwise distance of a user and a moving object, then four moving objects (m 12 , m 13 , m 11 , and m 8 ) are the closest to the query point q. However, taking into account the road intersection nodes and the moving objects' driving directions, the four moving objects (m 13 , m 11 , m 12 , and m 14 ) respond to user q because the moving objects m 12 and m 14 can turn around on the road intersection nodes v 1 and v 3 , respectively.
The Euclidean distance strategies for fixed objects ignore the complexity of the road network, such as the nearest gas station on a highway, and prefer to calculate the shortest distance in a straight line in space, without considering the driving direction of vehicles and road intersection nodes. Road-constrained distance strategies more suitably address the complexity of transportation conditions and moving objects.
A preliminary work [17] provided an outstanding contribution to road-constrained distance strategies of moving objects. The work proposed a tree-based k-NN search algorithm. The method first constructs the balanced search-tree index, divides the whole road network into multiple partial road networks by hierarchical iteration, and then bounds the vertices to calculate the k-nearest objects. However, the strong search-tree index of the road network and moving objects results in a high cost to update the active records on the search-tree index.
A state-of-the-art work is the tree-decomposed k -NN search algorithm [18], which contains a tree-based decomposition strategy to establish the one-to-one relationship between each vertex and tree node. This method can quickly calculate the shortest distance between any two nodes; however, it needs to recalculate for updated inputs of k, resulting in increased time consumption thanks to redundant calculations.
Thus, we propose an index-enhanced search algorithm for the k-NN query problem of moving objects in a road network. The contributions of this paper are summarized as follows: (1) A double tree-hash (DTH) index is designed to reorganize the weak relationships between the moving objects and the road network. The DTH index builds a weak bridge between tree and hash structures. The tree structure encapsulates the nodes, edges, and quantized relationships of intersubgraphs. The hash index records the moving objects. Through the weak bridge, the DTH index can realize the continuous updating-dynamic of moving objects in the road network (2) An index-enhanced k-NN search algorithm is proposed to quickly find the k-nearest neighbors of moving objects on the road network. We call this the DMOK algorithm. Firstly, we establish an updating model to maintain the moving object updates while quickly and effectively expanding the positive nodes. Secondly, conditional distance rules are designed to reduce the number of expanded negative nodes. Finally, the k answers are responses to the userdefined requests and obtained using the DTH index (3) Experiments with real data sets and artificial synthetic data sets verify the proposed algorithm's effectiveness The structure of this paper is as follows. Section 2 reviews related work. Section 3 introduces the related definitions of the k-NN search problem for moving objects on a road network. A tree-hash index is presented in Section 4. Section 5 presents the index-enhanced k-NN search algorithm. Section 6 gives the experimental results and analysis. Conclusions are provided in Section 7.

Related Work
This section mainly summarizes the related research on the nearest neighbor search, including the related works on k-NN search problems for fixed objects (Section 2.1) and moving objects (Section 2.2) on a road network.

Related Works about k-NN Search Problem of Fixed
Objects. The nearest neighbor search problem is one of the critical query types based on location services and was first proposed by Knuth in 1973 [19]. After ongoing research by many scholars, the theoretical knowledge has been enriched. The application field of the nearest neighbor 2 Wireless Communications and Mobile Computing search has also been broadened, such that the nearest neighbor search owns a pivotal position in location-based services. The earliest studies on k-NN search problems mainly focused on fixed objects, and two classic k-NN search algorithms are IER [20] and INE [20]. Incremental Network Expansion (INE) adopted the greedy idea of Dijkstra's algorithm and expanded the answer by constantly asking the node closest to node q. The advantage of the INE algorithm is that the concept is clear, and the implementation is straightforward. However, its disadvantages are also apparent. For one, it needs to visit all the vertices close to vertex q. However, the number of these vertices may be much larger than k, and many of the visited nodes may be far away from query point q; thus, there is no need to visit them all.
In addition, the time and space complexities of the algorithm are high within large-scale data. For example, when using the priority queues to store the distance from other vertices to q, the algorithm's time complexity can reach Oð|W | log | V | Þ, where W is the number of edges and V is the number of vertices in a graph. Therefore, the INE algorithm has a good time and space complexity within small data sizes; it can easily make a preliminary judgment based on the input data size and then decide whether to choose the INE algorithm.
Kolahdouzan and Shahabi [21] proposed an improved algorithm, the Voronoi Network Nearest Neighbor (VN 3 ) algorithm, which answers k-NN queries by dividing the spatial network into multiple smaller Voronoi polygons based on the object-driven precalculating network distances. However, the performance of VN 3 depends on the density and distribution of the specific data set. As the data set becomes denser, the computational cost of calculating the distance each time becomes higher. Therefore, VN 3 is only suitable for sparse data sets.
The programming complexity of the Incremental Euclidean Restriction (IER) algorithm is higher than that of INE, and it needs to use data structures for preprocessing, such as R-tree. The advantage of the IER algorithm is that it avoids redundant nodes, especially nodes far away from query point q that should rarely be visited. The disadvantage of the IER algorithm is that it still needs to check the extreme cases of all nodes, and its worst time and space complexity is no less than that of the INR algorithm.

Related Works about the k-NN Search Problem of
Moving Objects on a Road Network. Zhang et al. [22] proposed a keyword clustering query method (AKNN), which used user-specified query keywords to obtain text similarity. They designed a dual index structure (DG) generalized as a tree. The index structure saves the road network information and keeps the detailed knowledge of the network to establish an adjacency table. In literature [23], Huang et al. introduced the S-GRID algorithm to divide the spatial network into disjointed subnets and precalculated the shortest path of each pair within boundary nodes. In order to find k-nearest neighbors, network expansion is performed first within the subnet, and then, precalculated information is used to perform external expansion between boundary nodes. Samet et al. [10] proposed the DisBrw method, which precalculates the shortest path between all vertex pairs, and used a quadtree-based encoding for storing distance data. By storing the Euclidean distance as the shortest path distance boundary, they could find the k-nearest neighbors. Lee et al. [24] proposed a system framework called "ROAD" for spatial object searching on a road network. This method aimed at different object types effectively handled various location-related spatial queries, avoided the disadvantages that each node in the INE algorithm must be expanded, and directly skipped subnets with no obvious nodes of interest. Zhong et al. [25] proposed a balanced search-tree index (G-tree). G-tree uses a recursive segmentation method to divide the road network into corresponding subroad networks until the subnetwork is sufficiently small. This method can achieve an efficient search. Each node in G -tree is a subnet, and the leaf nodes in G-tree are equivalent to the nodes in a road network. If a leaf node and other external leaf nodes have directly connected edges, the leaf is the boundary of its upper network. Thus, G-tree calculates the shortest path of any two-leaf node boundaries on each divided network. In this paper, an assembly-based method is designed to calculate the minimum distance from the G -tree node to the query location and to reduce the complexity of the k-NN search problem.
Most studies on the underlying index structure employed the structures of R-tree [26] or other improved R-tree indices, such as R * -tree [27], FNR-tree [28], MONtree [29], STCode-tree [30], and DBR * -tree [31]. Other works have used the general R-tree expansion, which converted two-dimensional space and one-dimensional time data into three-dimensional space data processing; examples include the 3DR-tree [32], RT-tree [33], and STR-tree [34]. Luo et al. [35] proposed a TOAIN algorithm. It used the SCOB index to optimize searching or update processing time and conducted workload analysis to configure SCOB indices to maximize throughput. Tianyang et al. [36] proposed a new algorithm for direction-aware KNN (DAKNN) searching of moving objects on a road network. This method used R-tree and a grid as the index structure, and the authors also proposed a novel local network extension method to quickly determine the direction of moving objects, reduce the communication costs, and simplify the calculation of the moving direction between moving objects and query points.
Two main issues should be considered: (1) road network environment representation and (2) moving object processing. Existing works mainly used data graphs to simulate the existing road network in terms of a road network environment [37]. G = ðV, E, WÞ, where V is a node set and represents the connection between road segments, E is an edge set and illustrates the road segment in each road segment, and W means some additional information (road section cost, waiting time, etc.).

Problem Description
This paper focuses on quickly performing the k-NN search of moving objects on a road network environment and using the division strategy to improve the tree-mapping index 3 Wireless Communications and Mobile Computing mechanism for answering queries. Below, we introduce the definitions of the road network and associated concepts for the k-NN search on a road network environment. Table 1 lists and defines the main symbols used in this paper.
Definition 1 (road network). Given a directed weighted graph GðV, E, WÞ, where V is the road nodes and V = fv 1 , v 2 , ⋯, v i , ⋯, v n g. Each node v i represents the intersection of roads on a road network, E is the set of directed edges on a road network, and e 1,2 = ðv 1 , v 2 Þ means the edge from vertex v 1 to v 2 . W represents the weights of the edge on the road network, in the paper, which indicates the distance of the edge Distðv 1 , v 2 Þ, formed as wðv 1 This paper studies the k-NN query problem of moving objects on a road network. Before introducing the definition of the k-NN query, some definitions of road networks and moving objects are given.
Definition 2 (moving object). On the road network, each moving object is expressed as m = <ðv i , v j Þ, m:offset, t > ; that is, at time t, the moving object m is on edge <v i , v j > , and the position offset from the vertex of v j is m:offset.
As shown in Figure 2, the offset distance from m 13 to the end node v 2 on the edge e 3 , 2 is m 13 :offset = 2, and q:offset = 1 refers to the offset distance from the query object q to the start node v 2 on the edge e 1,2 which is 1.

Definition 3 (active node). A moving object m moves from
node v s to node v e , and then, we call v e a moving node of m. The active node of the subgraph G i is denoted as AcNodeðG i Þ.
For example, the moving object m 13 moves from node v 3 to node v 2 on edge < v 3 , v 2 > in Figure 2. Therefore, v 2 is called an active node of m 13 .
Definition 4 (moving object list). On a road network, a moving object is constantly moving, and its location information is regularly updated. The moving object list stores the positions of moving objects on the road network at a certain timestamp.
In Table 2, the moving object m 11 exists on edge Eðv 6 , v 2 Þ, and the distance from the terminal node v 2 is 1; meanwhile, the moving object m 12 exists on edge Eðv 3 , v 2 Þ, and the distance from the terminal node v 3 is 2. The number of moving objects with terminal node v 2 is 2. The moving object m 14 exists on edge Eðv 2 , v 3 Þ, and the distance from the terminal node v 3 is 2. Therefore, the number of moving objects with terminal node v 2 is 1.

Tree-Hash Index
This section introduces the double tree-hash (DTH) index proposed in this article, as well as the moving object update model (MOU-Model) based on the design of moving objects. We then introduce the processing method of moving object query on a road network, including the rapid solution of the road network distance and the fast processing of a query. Finally, a detailed introduction of the algorithm is given.

Division of Graphs.
Due to the complexity of the road network, the calculation cost of the direct k-NN query is too high for our algorithm, and thus, we first divide graphs.
Definition 5 (k division of graph). Given a graph G = ðV, E, WÞ, k division refers to dividing V into k subsets; that is, In the division of graphs, it is required that the number of edges E, where the associated vertices belong to different subsets, is minimized.
A tree hierarchy is established based on the graph division. The original graph is G, and graph G is divided iteratively as follows. Graph G is divided into f = 2 subgraphs G 1 , G 2 , G 3 , and G 4 ; these subgraphs are regarded as subgraphs of G. The subgraph set of G is denoted by CðGÞ. G is the parent graph, and G p i represents the parent-child graph of subgraph G i . Figure 3 shows the division process. For example, G 0 is divided into two subsubgraphs G 1 and Table 1: Description of the symbols used in this paper.

Symbol Meaning
K Returns the number of moving objects The starting node of the edge Wireless Communications and Mobile Computing G 2 , and then, CðG 0 Þ = ðG 1 , G 2 Þ and G p 1 = G 0 , as shown in Figure 3. Figure 4 is a subgraph of the road network.

DTH Index Construction.
The double tree-hash (DTH) index is based on the characteristics of the road network structure and the characteristics of moving objects. By constructing a tree index structure, the shortest path of any two nodes in the road network can be quickly determined using the static and complex road network information; moreover, by constructing a distance hash table index structure, fast batch updates can be made for the frequently updated moving object information.
The divided subgraph information and the subgraph border nodes construct the road network tree structure, as shown in Figure 5.
Definition 7 (DisSet). The node distance set stores the global shortest distance between all nodes in each leaf subgraph and stores the global shortest distance between all border nodes in the nonleaf subgraphs with common ancestors. This is denoted as For the leaf subgraph, S i ðv i Þ stores the global shortest distance from other nodes in the subgraph to v i ; for nonleaf subgraphs, S i ðv i Þ stores the global shortest distance from other border nodes to border node v i .
For example, for the leaf subgraph G 3 (Table 3), the global shortest distances between all nodes in the subgraph stored in the node distance set are stored in ascending order Tables 3 and 4 present the node distance sets of the leaf subgraph G 3 and the nonleaf subgraph G 2 , respectively. The bold numbers in the tables are the distances between the border nodes and the other relevant border nodes.

Corollary 9.
For the given two subgraphs G i and G j , the corresponding two nodes are v i ∈ G i , v j ∈ G j , and the two border nodes β i ∈ G i and β j ∈ G j . Similarly, Corollary 10. For a given number of subgraphs G i , G j , and G k , the corresponding nodes are v i ∈ G i , v j ∈ G j , and v k ∈ G k . G k is the subgraph connecting G i and G j , and each subgraph corresponds to the border node Proof. According to Lemma 8 and Corollary 10, it can be proved.
then H is called an inactive heap and is denoted as H InAc .
Proof. According to Definition 11, it can be proved. Because

DTH Index Process of Moving Objects.
On the road network, the location information of moving objects (such as vehicles) is updated constantly. The V-tree index structure proposed in [17] needs to rerecord the states of the active vertices and update the recent global activities. In a busy road section, the position of moving vehicles changes    Wireless Communications and Mobile Computing frequently in this environment. This update cost is very high, which is not conducive to query processing when moving objects change significantly. Thus, we propose a method based on updating moving objects. The road network structure diagram can be seen in Figure 6. For example, in the bustling section of the city center, the number of moving vehicles is large, and the range of position changes is relatively large. The position of the moving object at T = t and T = t + 1, and details of the moving objects are shown in Figure 7.
The existing k-NN algorithm only returns the k-nearest moving objects, regardless of their moving direction. After dividing the graph, according to the location relationship between the moving object and the query, it can be divided into the following situations.
As shown in Figure 8(a), the moving object is on the left side of the query, which is gradually approaching the query point along the road direction.
When Distðv 2 , v 1 Þ − m 12 :offset ≥ q:offset, the distance between the moving object and the query is Correspondingly, as shown in Figure 8(b), the moving object is on the right side of the query request point, that is, away along the road near the query point.
When Distðv 2 , v 1 Þ − m 12 :offset < q:offset, it is necessary to recalculate the information of the nearest k moving objects. The distance between the moving object and the query is Dist q, m 12 ð Þ= Dist v 1 , v 2 ð Þ+ m 12 :offset + q:offset: ð5Þ Table 5 lists the moving objects at time T = t. The gray entries denote nodes that are both a border node in the subgraph and an active node of the moving object.
For example, G 4 ð2Þ means that at time t, there are two moving objects (m 23 and m 24 ) in subgraph G 4 , and they are moving from node v 9 to node v 17 . v 17 is both the border node of subgraph G 4 and the active node of the moving objects m 23 and m 24 .
Due to frequent updates of moving objects on the road network, we can establish the hash table as shown in Tables 6(a) and 6(b), which use V E as the hash key and use (V S , M, Offset, M N ) as the value; the mapping function is the V E ⟶ ðV S , M, Offset, M N Þ.

Index-Enhanced k-NN Search Algorithm
This section mainly describes the proposed k-NN algorithm.
We present the calculation of the distance interval between two nodes and then the k-NN algorithm as a whole.

Node Expansion Strategy.
Due to the complexity of the road network environment, calculating the global shortest distance between nodes requires an enormous time cost. This paper uses an inverted index structure to manage the distance calculated on the road network. Specifically, we sort the distance between two nodes from small to large and insert this information into the heap. When the distance between two nodes is an interval, we sort from small to large according to the upper bound of the interval. During subsequent calculations, we always process the first element in the heap H.
Given two nodes v i and v j , v i ∈ G i , v j ∈ G j , we quickly determine the global shortest distance between the two nodes.
Definition 13 (ShortChain). Given a subgraph G i = ðV i , E i , W i Þ, for two nodes v i ∈ G i and v j ∈ G j , the shortest chain of v i , v j refers to the DTH index. The path taken by the smallest common ancestor is denoted as ShortChainðv i , v j Þ = fG i ⟶ G i+1 ⟶⋯⟶G j g, where G i is the leaf subgraph to which v i belongs and G j is the leaf subgraph to which v j belongs. The middle subgraph is the path of the divided subgraph (except for the common smallest ancestor) that G i to G j traverses.
For example, given two nodes v 31 and v 2 , the shortest chain from v 31 to v 2 is ShortChainðv 31 31 and v 2 have the smallest common ancestor G 0 . The shortest chain is shown in Figure 9.
Given two different nodes v i and v j , we have v i ∈ G i , v j ∈ G j , and G i ≠ G j .  Table 4: S 2 node distance collection.     Moving object list (T = t + 1)

Wireless Communications and Mobile Computing
(1) We determine the leaf subgraph G j where v j is located and add the distances from all border nodes in G j to v j into the heap H, in ascending order (2) We then process the first element v j−1 of the heap H and determine the next ShortChain subgraph as G j−1 according to the shortest chain ShortChainðv j , v i Þ sequence from v j to v i . Next, we calculate the respective border nodes of G j−1 to v j−1 and add them to the heap H in ascending order

(3) We end the expansion when the node expansion stop condition is met
When the node is expanded, the expansion is observed in heap H. When the following conditions are met for heap H, the node expansion ends: (1) When the nodes in heap H are expanded in sequence (2) When the nodes in the heap H have not been expanded, but the value of the first element of the heap H from the query point is greater than the set threshold or the maximum value in the candidate set Given two nodes, the calculation of the shortest chain is as shown in Algorithm 1.

DTH-Enhanced Nodewise Distance Calculation.
This section mainly describes the algorithm for calculating the shortest distance between any two nodes in the road network environment based on the DTH index structure. This DTH-based algorithm to calculate the distance between two nodes (called DCDP) combines the advantages of the DTH index and can complete a search quickly. At the same time, we use the node expansion strategy to reduce unnecessary node expansion and network overhead.
Definition 15 (conditional distance). Given three different nodes v i , v j , and v k , v i ∈ G i , BðG i Þ = fv k g, BðG j Þ = fv j g, and G i ≠ G j . The distance from v i through G i 's border node v k to v j in the subgraph G j is called the distance from node v i to v j under the condition of passing node v k . It is denoted as Distððv i , v j Þ | v k Þ.  Moving object list (T = t) Table 6 (a) The hash table of moving objects (T = t) Hash key The hash table of moving objects (T = t + 1) Hash key (AcNode V i ð Þ)

Wireless Communications and Mobile Computing
For example, for v 31 ∈ G 6 , we have BðG 6 Þ = fv 25 g and BðG 5 Þ = fv 11 g. The distance from node v 11 to node v 31 through border node v 25 is expressed as Distððv 11 , v 31 Þ | v 25 Þ.

Lemma 16.
Given two nodes v i and v j , the shortest path must pass through the border nodes of the divided subgraphs corresponding to ShortChainðv i , v j Þ, where multiple divided subgraphs can fit the same border node.
In the above example, ShortChainðv 31 We can directly obtain the distance between two nodes in the same subgraph through the node distance set, and thus, there is no need to calculate the shortest chain. For nodes in two different subgraphs, the process of calculating the shortest chain is as in Algorithm 1.
The process of calculating the global shortest distance between any two nodes is given below. According to the node distance set, the global shortest distance can be quickly obtained for two nodes in the same leaf subgraph (v s , v e ): (a) Use Algorithm 1 to calculate the shortest chain ShortChainðv e , v s Þ between v e and v s ; calculate the distance from the subgraph where v s is located to the border node of the next chain subgraph according to the shortest chain sequence, and store it in heap H (whose elements are sorted from small to large) In Section 5.1, we introduce the algorithm used to calculate the shortest chain. Based on the DTH index and Algorithm 1, we propose the DCDP algorithm to calculate the shortest distance between any two nodes quickly. The SPDistðv 31 , v 2 Þ solution process is shown in Figure 10. The specific description is given in Algorithm 2.
For example, the process of solving SPDistðv 31 , v 2 Þ is as follows: (1) According to Algorithm 1, the shortest chain from v 2 to v 31 is ShortChainðv 2 , v 31 Þ = fG 3 ⟶ G 1 ⟶ G 2 ⟶ G 6 g (2) According to the order of the shortest chain ShortChainðv 2 , v 31 Þ, expand using the node expansion strategy  For any nodes v i , v j , v k and subgraph G j , G j , the node distance set DisSetðD j Þ, where v i ∉ G j , v j ∈ G j , v k ∈ G j , and SPDistðv i , v j Þ can be directly calculated by Algorithm 2. Through the node distance set DisSetðD j Þ, we can obtain  break; 10 Get G i 's next chain graph G j according to ShortChain; 11 for every border point

11
Wireless Communications and Mobile Computing the distance SPDistðv j , v k Þ between any two nodes in the subgraph. Then, 5.3. Conditional Rules. To reduce the calculations required to obtain the distance between two nodes and perform node expansion, we propose a reduction strategy. First, through the expansion of the node, a distance interval is approximated, and the upper and lower bounds of the distance between the two nodes are determined. Then, in the expansion calculation, according to the upper and lower bounds determined above, we reduce the amount of calculation.
Definition 18 (distance interval). Given two nodes v i and v j ðv i ∈ G i , v j ∈ G j Þ in different subgraphs, the maximum distance between node v i and node v j in subgraph G j is called the upper bound of Distðv i , v j Þ and is denoted as upDistðv i , v j Þ. The minimum value of this distance is called the lower bound of Distðv i , v j Þ and is represented as Lemma 19 (conditional distance interval). Given nodes v i and v j , and v i ∈ G i , v j ∈ G j , and v k ∈ BðG j Þ, through node v k , the conditional distance interval from node v i to node v j is as follows: and thus, For example, to solve the distance interval between the node in G 5 through the border node v 25 to v 31 , that is, Dist ððBðG 5 Þ, v 31 Þ | v 25 Þ, the distances to the border nodes between G 5 and G 6 are showed in Table 7.

Corollary 21.
Given the subgraphs G i and G j , where i ≠ j, then minDistðG i , G j Þ = min fDistðBðG i Þ, BðG j Þg.
Proof. We know from Corollary 9 that the distance from node v i outside the subgraph to the subgraph G j must pass through the border node BðG j Þ of the subgraph G j . Similarly, the distance between the node of the subgraph G j and the subgraph G i must pass through the border node B ðG i Þ of the subgraph G i . Therefore, minDistðG i , G j Þ = min fDistðBðG i Þ, BðG j Þg, which can be obtained from the node distance set. The proof is complete.
For example, from Table 7, it can be seen that minDist ðG 5 , G 6 Þ = Distðv 5 , v 10 g = 5; that is, the shortest distance from subgraph G 5 to subgraph G 6 is 5.
For distance interval values with the same starting node and ending node, the upper bound takes a smaller value, and the lower bound takes a more considerable value.

Theorem 22.
Given that the nodes v i ∈ G i , v j ∈ G j , and v k ∈ BðG k Þ, and G i p = G k p , and Distðv k , v j Þ = K, for the first deter- Moreover, node v i does not need to be expanded in subsequent node expansion.
Proof. Suppose that there are nodes v i ′ , v j , and v k , v i ′ ∈ G i , v j ∈ G j , and v k ∈ BðG k Þ. Distððv i ′ , v j Þ | v k Þ is the smallest value because lowDistððv i ′, v j Þ | v k Þ = min fDistðv i ′, BðG j ÞÞg + Distðv k , v j Þ. Only Distðv i ′ , BðG j ÞÞ takes the minimum value, so Distðv i ′ , v k Þ takes the minimum value, because Dist Since v i and v i ′ are both in the same subgraph G i , the uniqueness of the node shows that the assumption that there is node v i ′ in the G i is wrong; that is, the value of Distððv i , v j Þ | v k Þ passes through the shortest distance of node v k . Furthermore, to reduce the redundant calculations in node expansion, the minimum node does not need to be expanded repeatedly. Figure 11 shows the query process for Queryðq, 5Þ. The number, which lies on the left of the box, means the query processing steps. The solid lines represent the q expansion process using the distance interval method, and the dotted lines represent the calculation amount using the expansion method compared to the standard calculation method, which is not using the expansion method. There are 40 solid lines and 12 dotted lines; the calculation efficiency of the expansion method is increased by 12/ð40 + 12Þ = 23%.

Tree-Based k-NN Search Algorithm
Definition 23 (adjacent subgraph). Take two subgraphs G i and G j , and G i ≠ G j , BðG i Þ = fv i g, and BðG j Þ = fv j g. G i and G j have a common ancestor, i.e., G i p = G j p . We call G i and G j adjacent subgraphs. The adjacent subgraph of border node v i is G j and is denoted by AdSubðv i Þ = fG j g.
For example, in Figure 6, v 23 is the border node of G 6 , and v 23 ∈ G 6 , G 6 p = G 2 , and G 5 p = G 2 . Therefore, G 5 and G 6 are adjacent subgraphs, and the adjacent subgraph of v 23 is G 5 . Furthermore, because v 23 ∈ G 2 , and G 2 p = G 1 p = G 0 , G 1 is the v 23 adjacency subgraph; that is, the adjacency subgraph of v 23 is G 1 . This is then denoted by AdSubðv 23 Þ = fG 5 , G 1 g.
Definition 24 (road network k-NN query). Given a directed weighted graph GðV, E, WÞ, M is the moving object set, and M = fm 1 , m 2 , m 3 , ⋯, m k g. The result of the query set is R. In the road network environment, the k-NN query at time t is expressed as k-NN = ðq, k, tÞ, where k is a natural number and q is the query point. These variables are expressed as follows: When giving a query point q, we query the k-nearest moving objects to q. First, we determine the subgraph G i in which q is located. The subgraph contains the number of moving objects M N and the starting node v i of the edge. According to the node distance set DisSetðD i Þ, we then find the distance between v i and the end node v e where each moving object is located. Next, we sort the items in heap H from small to large and process the first element of the heap.
For example, when given the query point q, k = 3 means that q is in the subgraph G 6 , and G 6 contains 5 moving objects. The starting node of its edge is v 31 , and we need to find the 3 moving objects closest to v 31 .
Here, we introduce the calculation for the k-NN for moving objects on the road network. In the existing k-NN algorithm for moving objects on the road network, there are redundant calculations. For this reason, we propose the DCDP-based moving object k-NN (DMOK) algorithm.
In the road network environment, for a given query point qðv s , q:offsetÞ, the k moving objects closest to the query point q are found, namely, Queryðq, kÞ. Figure 12 shows the processing of Query ðq, 4Þ. The specific calculation process is as follows: (1) Determine the subgraph G i of the starting node v s of q (2) Calculate the distance between the border node and the active node to v s in G i , and add the distance to H Ac . Calculate the distance from the inactive node in G i to v s , and add the distance to H InAc  Figure 11: The expansion process of query ðq, 5Þ.

Wireless Communications and Mobile Computing
(3) Expand according to the expansion strategy. According to the first element V cur of heap H Ac , if V cur is the border node, calculate the distance between the border node of the adjacent subgraph and v s , and add the node to H Ac (whose elements are sorted from smallest to largest). If V cur is the active node, calculate the distance between the moving object m and v s , and add m to the moving object candidate set Cset (4) According to the order of heap H Ac , the first element V cur of the heap is processed. When the number of moving object candidate set elements Cset:size ≥ k, take the distance between the kth m and v s in the moving object candidate set as the moving object distance threshold Dth, update Dth. When Dist ðV cur , v s Þ ≥ Dth, the processing of heap H Ac ends (5) Output the result set R of moving objects According to the node expansion strategy, and combined with the updating model, the set of moving objects that meet the query criteria can be quickly determined. Algorithm 3 shows the specific process.
For example, the process of solving queryðq, 4Þ according to Algorithm 3 is as follows: (1) Query point is qðV S , q:offsetÞ, V s = v 31 , and the offset from the starting node v 31 is q:offset = 0:5 (2) q ∈ G 6 , and according to the moving object table, the number of moving objects in the subgraph G 6 is 3 because the number of the moving objects M N = 3 < k = 4; it needs to further expand to adjacent subgraphs. Determine the distance from the end node V e of the moving object in the subgraph G 6 to the start node v 31 of the query point q, calculate the distance from the border node of G 6 to v 31 , and add nodes to H Ac . In the same way, add the node from the inactive node in the subgraph G 6 to the starting node v 31 of the query point q and add them to the heap H InAc   [14,20] …… v 13 → v 31 (19) v 4 → v 31 [14,20] …… v 13 → v 31 (19) v 10 → v 31 (8) …… v 13 → v 31 [18,19] v 11 → v 31 [7,13] …… v 23 → v 31 (14) algorithms on the BK data set. The abscissa is the variation range of k.
As can be seen from Figure 13, for different values of k, the search time of our algorithms is the least compared with the other two algorithms; this is due to the node processing strategy proposed in this algorithm. Because the TEN-Index can only query k-NN within the preset k value of the index, the query cannot be processed when the k value of k-NN is greater than the preset k value; the query is not compared to it in this set of experiments.
In Figures 14 and 15, we compared the DTH index construction time and space consumption with V-tree, TEN-Index, and G * -tree on the four data sets. Object density θ = candidate nodes/total number of vertices. In the experiment, k = 10, and θ = 0:3. We randomly generate 1000 vertices as query points and take the average total query time as the final query time. From the histogram, we can clearly see that building the DTH index proposed in the paper takes less time than other indices. Conversely, the building index times of V-tree and G * -tree are high; the main reason for this is that they set up an index of structural information such as nodes, edges, active nodes, and moving objects. Meanwhile, our algorithm constructs indices separately for road network information and moving objects. When moving objects are updated, we only need to update locally, which saves a lot of time. TEN-Index built the index the fastest because it uses H2H-Index for the shortest distance calculation of the road networks, unlike the other algorithms that use Dijkstra. The disadvantage of TEN-Index is that it depends on the      16 Wireless Communications and Mobile Computing value of k; that is, the value of k needs to be specified when building the index, and only queries within the value of k can be processed. Therefore, when the value of k is fixed, TEN-Index is relatively fast. In addition, its constructed index consumes much space and needs to be stored during tree decomposition. Considering a large amount of information, the index structure proposed in this article has certain advantages. It can be seen from Figure 16 that the TEN-Index algorithm has weak adaptability to the value k, and the method proposed in this paper has advantages over the other algorithms in terms of search time. The reason for this is that in the initial stage of index construction, although a certain amount of space consumption is sacrificed, in the latter search, the proposed algorithm dramatically improves the search time due to its node strategy and avoidance of redundant calculations.

Conclusions
This paper studies a fast tree-indexed k-NN search algorithm of moving objects on a road network. Firstly, a novel index structure, called the double tree-hash index, is designed to reorganize the relationships between moving objects and the road network. The DTH index builds a weak bridge between tree and hash structures. The tree structure encapsulates the nodes, edges, and quantized relationships of intersubgraphs. The hash index records the moving objects. Through the weak bridge, the DTH index can realize activity-oriented updates of moving objects in the road network. Secondly, an index-enhanced k-NN search algorithm is proposed to quickly find the k-nearest neighbors of moving objects on the road network. This algorithm is called the DMOK algorithm. An updating model is established to quickly update the moving object and effectively expand the positive nodes. Through the conditional distance rules, the number of expanded negative nodes can be reduced. Then, multiple answers are provided to queries based on the DTH index. Finally, experiments with real data sets and artificial synthetic data sets verify the algorithm's effectiveness.

Data Availability
The data used to support the findings of this study have been deposited in the Road Networks, Urban (2016)

Conflicts of Interest
The authors declare that there is no conflict of interest regarding the publication of this paper.