*5.1. Parameter Setting*

The comparative test is implemented in Java and run on an Intel (R) Core (TM) i5-6200U CPU @ 2.30 GHz processor, 4G memory, and 64-bit Windows 10 operating system. The comparative test data in this paper include road network data and moving object data, as presented in Table 1. The road network data are based on Los Angeles from TIGER/Line [28] and include 195,888 road nodes and 267,536 edges. At the same time, the Brinkoff Road Network Data Simulator [29] was used to generate moving object data with moving directions. When the moving object arrives at a road network node, it randomly selects the next path. These data objects are evenly distributed in the road network, and there are 10,000–100,000 of them.


**Table 1.** Comparative test data.

The performance of the comparative test algorithm is mainly measured in terms of the CPU execution time. The e ffects of the number of moving objects, the number of *K*-nearest neighbors and the time interval of continuous query on the query performance are investigated via the control variable method. Because the location of the query point a ffects the execution time, we execute 1000 non-concurrent queries at various locations and the average execution time is taken as the comparative test result for analysis. The default settings of each parameter are adopted by the current mainstream continuous nearest neighbor queries of moving objects that are based on the road network, as listed in Table 2.

**Table 2.** Default parameter settings for comparative tests.


In addition, we analyzed the performances and accuracies of the CKNN, SCKNN, and DACKNN algorithms, and demonstrated the advantage of DACKNN.

#### *5.2. Comparative Test Results and Analysis*

First, the DACKNN algorithm is analyzed under various parameter settings. Second, the time efficiency and accuracy are compared with those of the SCKNN and CKNN query algorithms. Finally, the shortcomings are identified to facilitate improvement in future work. In this comparative test, default values are used for all variables unless otherwise specified.

#### 5.2.1. Evaluation of the DACKNN Algorithm

We conduct a series of comparative tests in which we vary the number of neighbors: *K*, the number of moving objects and the time interval and analyze the performance of DACKNN under the parameter settings.

(1) The influence of the number of moving objects on the query performance. According to Figure 10, the value of *K* is 30. In the comparative tests, we compared the e ffects of the number of moving objects on the overall continuous query performance in three-time intervals: [0, 30], [0, 60], and [0, 90]. As shown in this Figure 10, the overall query time increased with the number of moving objects and when the number of moving objects is between 10,000 and 20,000, the query performance among the query intervals tended to be stable. This is because the number of objects in the local road network that was established by the monitoring range increased and the time cost of judging whether each moving object was moving towards the query point and executing the verification algorithm also increased. As shown in Figure 14, according to the number of moving objects in the global road network, the number of moving objects in the local road network that was established by the monitoring range of time intervals [0, 30], [0, 60], and [0, 90] is displayed. The figure shows that as the number of moving objects in the global road network increases

gradually, the number of objects in the local road network also increases. The more objects there are, the longer it takes to evaluate the candidate objects. Hence, the complete algorithm becomes more time-consuming as the number of moving objects increases. From Figure 10, we also can see the larger the time interval, the higher the time cost of the algorithm. In di fferent time intervals, when the interval di fference is not very large, the calculated monitoring distances are similar and the numbers of moving objects in the local road networks that were established according to the monitoring ranges are almost the same. However, the longer the time interval is, the more time-consuming the whole algorithm will be, because the longer the time interval is, the number of moving objects that have arrived at the nodes increases, the time interval is divided into several sub-intervals according to their arrival times, and the road network distances between them and the query object are recalculated; thus, the time-consuming will increase accordingly.


of the total time consumption of the algorithm. In the process of continuous monitoring of nearest-neighbor queries, the monitoring range is calculated by traversing the KNN result set, which costs little time. The time consumption of the stage of identifying candidate objects via road network expansion accounts for the majority of the total time consumption of the process. In this stage, the local road network is constructed according to the monitoring range and the moving objects in the local road network are evaluated. In the process of identifying the moving objects, according to the diagram, the time-consumption occupancy ratio is the highest out of the whole process when the number of *K*-nearest neighbors is small. In the process of validating the candidate objects, the time interval is divided into several sub-intervals according to the arrival timestamps of the candidate objects at the node of the road network and a result set is obtained in each sub-interval. When dividing the time interval, it is necessary to update each object that arrives at the node and to recalculate the road network distance to the query point. The more candidate objects and *K-*nearest neighbors, the higher the time consumption of the validation process; the time consumption of the verification stage will also increase.

**Figure 9.** Effect of K value on Performance.

**Figure 10.** Comparisons of time consumed with the number of moving objects in different time intervals.

**Figure 11.** Effect of different time intervals on performance.

**Figure 12.** Time-consuming for each stage of continuous query for different K values.

**Figure 13.** The number of nodes, edges, and moving objects in local road network with different K values.

**Figure 14.** The number of objects in local road networks varies with the number of moving objects in different time intervals.

Then, the comparative test makes the following comparisons according to the various query time intervals. When the number of moving objects is 30,000 and the number of neighbors, namely, *K*, is 10, the time distribution of each stage of the algorithm is observed for various query time intervals: [0, 20], [0, 40], [0, 60], [0, 80], and [0, 100]. In Figure 15, the histogram shows the time distribution of each stage of the algorithm and the time-consumption trend is stable for acquiring direction-aware neighbors and monitoring ranges. When the number of *K*-nearest neighbors is constant, the time-consumptions of the *K*-nearest neighbor queries that are acquired at the starting time are stable when the starting times are the same. In the whole process, it is time-consuming to obtain and verify candidate objects. In the stage of obtaining candidate objects, the influential edges are identified according to the monitoring range, a local road network is created, and the moving objects in the local road network are retrieved as candidate objects. With the increase of the time interval, the monitoring range becomes larger and the amount of data that must be processed increases. The time-consumption of the candidate validation stage increases with the time interval. The longer the time interval is, the larger the monitoring range is, the more edges that must be retrieved, and the larger the number of candidates that must be evaluated. Moreover, the longer the time interval is, the larger the number sub-intervals into which it must be divided. For each sub-interval, the candidates must be evaluated; thus, the time-consumption increases with the number of sub-intervals.

**Figure 15.** Time-consuming for each stage of continuous query in different time intervals.

To deal with the continuous *K*-nearest-neighbor query and improve the query efficiency, we must transform the global network into a small-scale local network to facilitate the retrieval of objects. We analyze the time-consumption of the whole process of constructing the local network. As shown in Figure 16, in the process of local road network construction, the time consumption of determining the monitoring range is very small. According to the size of the monitoring range, the query point-centered edge is acquired and the local road network is constructed on the edge of the monitoring range; this process is time-consuming. As the time interval increases, the monitoring range increases and the acquisition influence edge becomes larger, thereby increasing the processing time. The time consumption for calculating the shortest path of a single source on a local road network is negligible.

**Figure 16.** Time-consuming of local road network construction stage under different time interval.

#### 5.2.2. Comparison with Other Algorithms

First, we evaluate the effects of the CKNN, SCKNN, and DACKNN algorithms on the time consumption as the time interval increases and their accuracies. Here, accuracy refers to the accuracy with which moving objects that are moving towards the query point are identified, which is expressed as a percentage. According to Figure 17, the time costs of these three algorithms increase with the time

interval because more moving objects will arrive at the network nodes over a larger time interval; thus, the time interval is divided into more sub-time intervals for verification. However, the time costs of CKNN and SKNN increase faster as the time interval increases because these two algorithms do not screen out objects that are moving towards the query object, but consider all objects in the monitoring range as candidates; thus, the more objects they deal with, the more time they consume. The DACKNN algorithm can filter out objects that are moving away from the query point in the monitoring range. Thus, the number of candidate objects is smaller; therefore, DACKNN outperforms SCKNN and CKNN in terms of time consumption. Figure 18 shows the accuracies of these three algorithms. The moving objects that are moving towards the query object can be obtained with 100% accuracy by the DACKNN algorithm as the time interval increases, while the accuracy of SCKNN reaches more than 70%, and the accuracy of CKNN is approximately 50%.

**Figure 17.** Time consumption of algorithms under different time intervals.

**Figure 18.** Accuracy of algorithms under different time intervals.

Figure 19 shows that the time costs of CKNN, SCKNN and DACKNN will increase as the value of K increases. This is because with the increase of K, a larger monitoring range is needed to ensure that there are K objects in this range, and more candidate objects are needed to verify. The overall time consumption of the proposed DACKNN algorithm is lower than those of other two query algorithms, and its overall performance is higher than CKNN and SKNN. Figure 20 shows the accuracy of three algorithms with the increase of *K*. It can be seen that the moving objects towards query object can always be obtained 100% by DACKNN algorithm as *K* increases, while the accuracy of moving objects obtained by SCKNN algorithm is between 60% and 80%, and the accuracy of CKNN algorithm is nearly 50%.

**Figure 19.** Time consumption of Algorithms for different K values.

**Figure 20.** Accuracy of Algorithms for different K values.

The results show that the proposed DACKNN algorithm is superior to SCKNN and CKNN. By utilizing the directional characteristics of moving objects, the DACKNN determine moving objects moving towards query point, and filters out some objects far from the query point in the monitoring range, thus improving the overall performance and effectiveness of the query algorithm.
