Distance-Constraint k-Nearest Neighbor Searching in Mobile Sensor Networks

The k-Nearest Neighbors (kNN) query is an important spatial query in mobile sensor networks. In this work we extend kNN to include a distance constraint, calling it a l-distant k-nearest-neighbors (l-kNN) query, which finds the k sensor nodes nearest to a query point that are also at l or greater distance from each other. The query results indicate the objects nearest to the area of interest that are scattered from each other by at least distance l. The l- kNN query can be used in most kNN applications for the case of well distributed query results. To process an l-kNN query, we must discover all sets of kNN sensor nodes and then find all pairs of sensor nodes in each set that are separated by at least a distance l. Given the limited battery and computing power of sensor nodes, this l-kNN query processing is problematically expensive in terms of energy consumption. In this paper, we propose a greedy approach for l- kNN query processing in mobile sensor networks. The key idea of the proposed approach is to divide the search space into subspaces whose all sides are l. By selecting k sensor nodes from the other subspaces near the query point, we guarantee accurate query results for l- kNN. In our experiments, we show that the proposed method exhibits superior performance compared with a post-processing based method using the kNN query in terms of energy efficiency, query latency, and accuracy.


Introduction
Advancements in wireless technology and sensors have enabled rapid development of mobile sensor networks in which moving sensor nodes are wirelessly connected. Recently, mobile sensor networks have received a lot of attention because they have a variety of applications, such as intelligent transportation systems [1], wildlife conservation systems [2], and battlefield surveillance systems [3].
The -nearest neighbors ( NN) query is an important spatial query in spatial or multidimensional databases [4][5][6]. In mobile sensor networks, the NN query is to find the sensor nodes closest to the query point . The NN query can be used in vehicle navigation, wildlife social activity discovery, forest fire impact investigations, and squad/platoon searches on the battlefield [7].
Traditional NN query processing techniques assume the context that location data are collected in a centralized database [8,9]. Collecting a massive amount of sensed data to a centralized database incurs unnecessary and redundant message transmissions. These traditional techniques are infeasible for mobile sensor networks due to the high communication cost and energy consumption. Recently, in-network techniques have been proposed to overcome these problems. Representative NN query processing techniques are PT [10], KPT [11], DIKNN [12,13] and GDRKNN [14]. Studies of these methods have shown improved performance by using index and ad hoc geographic routing techniques. Especially, they have focused on reducing the number of transmissions because the greatest energy consumption by sensor nodes is due to communication.
This paper focuses on a novel spatial query problem, the NN query with a distance constraint, named -distant -nearest neighbors ( -NN). The -NN query finds the sensor nodes nearest to the query point and at least separated from each other by a distance . One of main objectives of the NN query is to facilitate collection of sensor data samples around the query location in the applications [15]. However, since the existing NN query does not consider the distribution of the objects in the query result, it has the severe drawback that the objects sampled can be skewed only in a small area rather than the whole area of interest. If we need well distributed or wide coverage of the NN result in the applications of the NN query, the -NN query is more suitable because it finds well scattered objects over the area of interest. An example of -NN query is survival discovery on the battlefield [7]. Suppose we want to seek for the nearby survivals around a battlefield stronghold. While the NN query finds simply nearest survivals, our proposed -NN query can reveal the distribution of survivals around the battlefield stronghold. Figure 1 shows comparisons of results between the NN and the -NN queries when is set to 4. Given the query point , the result for the NN query is , , and , which are skewed in a small area and cover only the left side of the query point. When increases from 4 to 5, the right side is still not covered because is selected additionally. The result for the -NN query is , , and , which covers the wider area in a well distributed way.
Considering the limited computing power and batteries of sensor nodes, processing a -NN query is problematically expensive in terms of energy consumption in mobile sensor networks. For sensor nodes, n is the number of cases possible for selecting sensor nodes. Moreover, we need to verify the -distant constraint between each pair of sensor nodes k times for each case. To compute the -NN query for all the cases, a great number of message transmissions would be required, which would incur huge battery consumption. Especially, sensor nodes located far away from the query point require large battery consumption because they must transmit messages to the query node through several intermediate sensor nodes. In this paper, we propose a greedy approach for -NN query processing in mobile sensor networks.
The key idea of the proposed approach is to divide the search space into subspaces whose sides are all . By selecting sensor nodes from the other subspaces near the query point, we can obtain accurate query results for -NN. The proposed approach has several challenging issues, including estimating the search space, dividing the search space with the constraint, and traversing between the subspaces. We present efficient solutions for each of these challenges. In our experiments, we show that the proposed method exhibits superior performance compared with a post-processing based method using the kNN query in terms of energy efficiency, query latency, and accuracy.
The rest of the paper is organized as follows: Section 2 reviews the existing NN query processing techniques. Section 3 presents the proposed -NN query in detail. Section 4 reports the performance evaluation through various experiments. Finally, Section 5 provides the conclusions for the paper.

Related Work
Wireless sensor networks (WSNs) are composed of many devices that sense, store, and transmit data. WSNs have limitations in processing queries because the sensors have limited power supplies, are vulnerable to failure, and have the dynamic property that their availability can vary over time.
NN queries retrieve the sensor nodes nearest to a point of interest indicated by users, called a query point in WSNs. The NN query can be used to search in border detection and ecological monitoring. NN queries in WSNs have been actively studied to optimize performance given the above limitations of WSNs. NN query processing approaches can be categorized as either fixed index or dynamic index. Fixed-index approaches use a stationary structure based on an R-tree or a spanning tree [10]. These approaches have the critical problem of maintaining the index when the sensor nodes are mobile. Dynamic-index approaches propagate the NN query gradually along itineraries to collect data from sensors in a specific region [11][12][13].
The approaches using a fixed-index structure [10] have several problems. The major problem is that index nodes become system bottlenecks because all the query messages are aggregated by index nodes designated cluster heads. Moreover, large numbers of unnecessary hops from the query point are required because all the query messages are routed along the index hierarchy. This overhead causes significant performance degradation in a large WSN.
To overcome these issues, approaches that do not use the fixed index structure have been proposed [11][12][13]. KPT [11] assumes a location-aware sensor network and estimates a conservative boundary that includes at least sensor nodes to avoid messages' flooding the entire network. However, mobile sensors cause problems in this approach because KPT assumes that the nodes are stationary. The reconstruction cost of the tree is considerably large when the sensor nodes are moving. Moreover, the conservative boundary expands dramatically with increasing . Some sensor nodes may even turn aside from the boundary during tree construction.
The itinerary-based NN (IKNN) approach [12,13] has been proposed to solve these issues. This approach uses both sequential and parallel itinerary processing approaches instead of the tree structure. Two formats have been proposed for the itinerary in IKNN: spiral and parallel. With the spiral itinerary format, the query dissemination starts at the node closest to the query point and follows an itinerary in the form of a spiral. When the number reaches , the query dissemination is stopped, and the result is sent back to the originator. With the parallel itinerary format, the query dissemination also starts at the node closest to the query point, but it then follows two parallel itineraries. The query stores the number of nodes that answered the query. Neighbor nodes in the different itineraries sum their counts to calculate the total number of nodes that answered the query.
The density-aware itinerary-based NN (DIKNN) approach [13] divides the region of interest into cone-shaped areas centered at the query point. In each area, an itinerary is created along which a NN query is propagated. Itinerary information exchanges occur when itineraries encounter a sector border. When a KNN query reaches a NN boundary, the last query node in each sector sends the partial results directly to the source node. Through good estimation of the NN boundary, DIKNN improves its query latency over IKNN. However, the accuracy of the NN boundary estimation is critical. Although the NN approach dynamically adjusts its estimated NN boundary, redundancy still exists in the NN query result of DIKNN because the partial NN query results from all sectors are sent back to the source node without any validation. Furthermore, itinerary structures developed in IKNN and DIKNN do not explore the issue of optimizing the number of NN query threads.
NN boundary estimation methods have been proposed to improve the performance of the NN query. The grid division routing mechanism based NN (GDRKNN) [14] controls the query boundary expansion based on the number of NN sensors in wireless sensor networks of skewness distribution. The extended explosion method (EXP) [16] estimates the NN boundary based on the density of sensor nodes in the entire sensor network where the density of sensor nodes is not uniform.
Many studies have proposed ways to optimize the performance of the NN query in various environments or conditions [17,18]. Xie et al. [17] proposed NN query processing method in wireless and robot networks (WSRNs). Huang at al. [18] proposed an efficient algorithm to process the NN query for moving objects in a grid-based sensor network.
However, to the best of our knowledge, no research has been done on NN processing considering distance constraints between nearest neighbors in WSNs. We focus on searching for the nearest neighbors that satisfy the constraint that each sensor node is separated away from ever other by at least a distance l.

l-k-Nearest-Neighbors Query Processing
In this section, we first provide a formal definition of our -NN problem in Section 3.1. We then describe the overall process of -NN in Section 3.2 and explain core phases of -NN in detail in Sections 3.3 and 3.4.

Problem Definition
The -NN problem is formally defined as follows:  Definition 1 ( -distant -nearest neighbor problem). Given a set of sensor nodes, a query point and valid time , find a subset ′ of with nodes (i.e., ( , ) ≤ ( , ) and ∀ ∈ ′, ∀ ∈ , ( , ) ≥ , where ( ) denotes the Euclidean distance function.  We assume that the sensor nodes are randomly distributed and moving in wireless sensor networks. Each sensor node's movement direction and velocity are randomly determined. All sensor nodes have their own storage and computing power to process queries. Each sensor is aware of its own location via GPS or other localization technique, such as beaconing.  We define new concepts to traverse the search space for -NN.  Definition 2 (sector). Given a query point , a sector is the fan-shaped area between two radii centered at . Given that the number of sectors is , each sector has the same central angle .
Sector numbers are reassigned in each track.  Definition 3 (track). Given a query point , a track is the ring-shaped area centered at . The -th track centered at is defined as presented in Equation (1), where ( ) denotes a circle centered at with a radius , where > .
 Definition 4 (track-sector). A track-sector is the intersecting area of a track and a sector.  We define the following notations to simplify the explanation of -NN. A home node (H-node) is the sensor node nearest to the query point . We call a sensor node selected for query results a query node (Q-node). If a track contains a query node, it is called a query track; otherwise, a margin track. If a sector contains a query node, it is called a query sector; otherwise, a margin sector. Figure 2 shows examples of sectors, tracks and track-sectors. , , and are tracks having radii , 2 , 3 and 4 centered at , repectively. The number of sectors is eight, and each sector has a central angle . The track-sector , represents the intersecting area of and . and are query tracks, and the others are margin tracks. We regard is a margin track, although the H-node is selected for the query results. , , and are query sectors, and the other sectors are margin sectors.

Overall Process
The basic concept of our -NN query processing is to divide the search space into several track-sectors whose sides are all larger than . We then select one Q-node in each of the other track-sectors. Therefore, the Q-nodes are at least distance from each other because a track-sector with a -node is surrounded by margin tracks and sectors. For example, , is surrounded by two margin tracks and , and two margin sectors and , as shown in Figure 2. The overall processing of a -NN query consists of four phases:  Routing phase: A query message is routed from the source node to the H-node. GPSR [19] is adopted as the routing algorithm. In this phase, the sensor network information, such as the number of nodes, is collected without the assistance of any infrastructure.  -NN boundary estimation phase: The H-node estimates a searching boundary. The -NN boundary is dynamically estimated according to the distance constraint and the number of neighbors .  Query dissemination phase: The H-node disseminates the query message to other sensor nodes within the -NN boundary. In order to guarantee the distance, the query message is propagated to the query tracks and query sectors.  Aggregation phase: The H-node aggregates the query results. The aggregated query results are transmitted back to the query source by the GPSR.
The routing and aggregation phases are very similar to existing NN query processing techniques. Compared with NN query processing, our proposed -NN query processing is mainly different in the -NN boundary estimation and query dissemination phases. We explain the details of these phases in Sections 3.2 and 3.3.

-NN Boundary Estimation
The H-node disseminates a query message to the other sensor nodes. The query message is progressively propagated to sensor nodes farther from the H-node. Because we do not have information about the sensor node distribution, we must estimate a maximum boundary for the -NN query ( -NNB) by considering the worst case. A large -NNB guarantees correct query results but incurs large energy consumption and slow query responses. However, a small -NNB decreases query accuracy because some query results are located outside of the -NNB.
Let be the radius of the -NNB. According to the definition of an -NN query, we need to find the sensor nodes nearest to the H-node that are at least distance apart. Therefore, is calculated as in Equation (2). All query results are then guaranteed to be located within the radius : A sensor node can send messages to other nodes within the sensor's radio range. If it sends messages to other nodes located outside its range, the query message traverses several hops between the source and destination. Therefore, we need to estimate -NNB differently according to the ratio of to the sensor radio range . We refine Equation (2) as Equation (3) with consideration of the ratio: If < , -NNB is estimated as × . A single is enough to maintain the distance between two Q-nodes because is shorter than . If = , -NNB is estimated as × 2 × . Although is equal to , we need 2 × to ensure the distance is maintained between two Q-nodes. This is because of the possibility that no sensor node exists on the circumference of . If > , -NNB is estimated as × ( + 1) × . To maintain , we need one more than for the case of = because is larger than . Figure 3 shows examples of l-kNNBs with various ratios of r to l when k is 2. Figure 3a-c represent estimates of -NNBs for the cases of > , = and < , repectively. According to Equation (3), is estimated as 2 × , 2× 2 × and 2 × (2 + 1) × when is , and 2 , respectively. The distance between the Q-nodes is longer than in all cases.

-NN Query Dissemination
After -NNB is determined, the query message is progressively disseminated from the H-node to the circumference of -NNB. Tracks are extended from the H-node to -NNB, and each track is divided into sectors. The query is propagated to the query tracks and query sectors. This process is repeated until the query message reaches -NNB.
We observe that odd track numbers are margin tracks and even track numbers are query tracks. This is because we select the Q-nodes in the other tracks. In each margin track, the central angle and the number of sectors are calculated for dividing the track into sectors. Notice that the central angle and the number of sectors are recalculated in each margin track. This is because this procedure keeps tight distances between query sectors. If we divide all tracks into sectors with the same central angle as in the first track, farther track-sectors have longer chards than , leading to low quality query results because the size of margin sectors is determined too loosely.
Consider an H-node with coordinates ( , ) and any margin track centered at with radius . is sequentially divided into several sectors from the baseline = in the counterclockwise direction. The central angle and the number of sectors are determined depending on the distance constraint . We have a well-known equation involving a central sector, a radius, and a chord as in Equation (4): Because we want all sides of each track sector to have length , is calculated as ( × ) × = × . We can also calculate as = . When a track is divided into sectors in the counterclockwise direction, the last sector has a central angle smaller than . In this case, the last sector is merged with the previous sector. In this way, we can guarantee that all chords of sectors have lengths of at least . In each query track, Q-nodes are selected in every other track-sector. In a track-sector, a length of an upper chord is longer than because that of a lower chord is . Therefore, the Q-node is selected around the inner corner intersecting the lower arc and the margin sector in order to keep the distance constraint tight. In a track-sector of a margin track, an upper chord is , and a lower chord is shorter than . This is why we select the Q-nodes in query tracks rather than in margin tracks.
For a tight distance between query tracks and query sectors, it is also possible to set the radius of query tracks and the chords of query sectors to rather than , when is shorter than . If we set the radii of query and margin tracks to the same distance , the average distance between Q-nodes is 2 × . By using for the radii of query tracks and chords of query sectors, the distance is reduced by 2 × to + .  In the following, we explain how the query message is disseminated. In a NN problem, the query message should be disseminated to all sensor nodes in each track-sector because there can be more than one Q-node in a track-sector. However, in our -NN problem, we do not need to traverse all sensor nodes. One track-sector can contain at most one Q-node, and we can calculate roughly where the Q-nodes are. Therefore, once the query message reaches a Q-node in a track-sector, the query message escapes this track-sector and heads quickly to the next track-sector containing a Q-node.
The query message traverses between only those track-sectors containing Q-nodes. As explained above, the Q-node is selected around the inner corner intersecting the lower arc and the margin sector in a query track. We regard the corners as virtual vertices because we cannot know whether any sensor nodes exist in the corners. The query message is propagated to the virtual vertex along borders of tracks and sectors by itinerary traversal [7]. The Q-node is selected near the virtual vertex. The itinerary traversal selects the next sensor nodes in the range of √ rather than in order to balance query accuracy and energy efficiency [20]. If there is no sensor node near the virtual vertex, we seek the Q-node by routing around the virtual vertex based on the right-hand rule of GPSR. Figure 5a shows an example of query dissemination in a sector, where is a virtual vertex and is a Q-node. The virtual vertices , and are the corners intersecting the lower arc and the margin sector in query tracks. Q-nodes , and are the nearest vertices to the virtual vertices, respectively. The query message is propagated from to and from to along the borders of the sector and tracks by itinerary traversal. Figure 5b shows an example of the right-hand rule of GPSR. If there is no sensor node near the virtual vertex , we try to route around to seek the path from H-node to the next Q-node, . For fast query processing, we adopt parallel computing for query dissemination in each sector. The query dissemination in each sector is an independent subtask. Therefore, this parallelization reduces query latency without accuracy degradation. The number of subtasks has a great effect on the performance. When the number of subtasks is large, network throughput degrades because contentions and collisions occur frequently at the data link and physical layers. Conversely, a small number of subtasks increases latency. Considering this analysis, we determine the number of subtasks as the number of sectors in the first track. Since the query message traverses only the track-sectors containing Q-nodes that are surrounded by margin tracks and sectors, contentions and collisions are minimized in the parallel query dissemination.
At the end of dissemination, query responses are aggregated at the H-node. The H-node can take more than k number of Q-nodes because -NNB is the estimated boundary considering the worst case. To select the nearest number of Q-nodes, the Q-nodes are sorted in ascending order according to their distances from the H-node. Finally, the H-node selects the top-number of Q-nodes and transmits back to the query source by GPSR.

Algorithm for Query Dissemination
Algorithm 1 is the pseudo code for processing the -NN query. The algorithm searches an H-node ℎ nearest to the given query point (line 1). The H-node ℎ is included in a query result set (line 3). Flag is used to check whether any Q-node is selected in a query sector (line 4). The query message is propagated forward from the H-node ℎ to other sensor nodes within the -NNB (line 5). search_next_vnode( ) is called to determine the next forward sensor node (line 6). We explain search_next_vnode( ) in Algorithm 2, as follows. If the next_vnode is the starting point of a new track-sector, the flag is set to "false" in order to select a Q-node in this track-sector (lines 7-8). The algorithm selects the next forward sensor node nearest to the next_vnode by using GPSR (line 9). Lines 6-9 are repeated until reaching -NNB. The Q-nodes in the resulting set are sorted in ascending order according to their distances from the H-node (line 10). The top-sensor nodes in are returned as the query result (lines [11][12].

Algorithm 1 -NN Query Processing
QueryDissemination ( , , , , ) ⦁Input: number of sectors , query point , distance constraint , number of nearest neighbors , and -NNB ⦁Output: a result set including Q-nodes ; 1: Search a home node ℎ nearest to the query point ; 2: cur_node ← ℎ; 3: Initialize a result set ← {ℎ}; 4: flag ← false; // the status that the Q-node is not selected yet in a query sector 5: while (cur_radius < ) 6: next_vnode ← search_next_vnode(ℎ, , , , , cur_node); // find the next virtual node 7: if ( next_vnode is the vnode intersecting track and sector) // the starting search point of TS 8: ← false; 9: cur_node ← GPSR (cur_node, next_vnode); // find the sensor node nearest to the next_vnode 10: Sort Q-nodes in in ascending order according to the distance from the H-node; 11: ← select top-Q-nodes; 12: return ; Algorithm 2 is the pseudo code for determining the next search direction. To determine the direction, each sensor node should know its own sector number and track number, and the four borderlines of the track-sector. Algorithm 2 includes the calculation of all of this information about the current sensor node. Each sensor node can calculate the discriminants determining the borderlines of its own track-sector by using its own coordinates and those of the H-node.
The current sensor node calculates its distance from the H-node. The track index that the sensor node belongs to is calculated by dividing the distance by the track radius (line 2). The algorithm calculates the radius of the current track by multiplying the track index by the track radius , which is the upper arc of the current track (line 3). The lower arc of the current track is -because the radii of the tracks increase by . Therefore, we can derive the discriminants that calculate the upper and lower arcs of the track having radius centered at ℎ (lines [4][5]. The algorithm checks whether the current track is a margin track or a query track (line 6). If the current track is a margin track, the query message is passed to the next track (lines [11][12]. Otherwise, the algorithm checks whether a Q-node is selected (line 7). If a Q-node is selected, the query message is passed to the next track-sector (lines 7-8). Otherwise, the query message is passed to the next_vnode along the lower arc in the current track-sector (lines 9-10). The chord is calculated as √ for the central angle . This is the optimal chord to select the next sensor node without interference among the sensor nodes.
After obtaining for dividing the search space into sectors, the algorithm calculates the sector number of the current sensor node by using the coordinates of the current sensor node and the home node (lines [13][14]. The algorithm derives the discriminants that calculate the right-and left-side lines of the current track-sector by using and (lines 15-16). We can obtain the corner points from the four discriminants of the borderlines of the current track sector (line 17). If the current track-sector is a query one and no Q-node is selected, the algorithm selects the sensor node nearest to the corner intersecting the lower arc and the margin sector (lines [18][19][20][21]. After selecting the Q-node, the algorithm determines the next direction and the next_vnode (lines 22-23). Because the algorithm adopts itinerary traversal [13] to select the next track in a sector, the query message is passed to the next sensor node in the east direction in odd-number tracks. Conversely, the query message is passed in the west direction in even-number tracks. The algorithm finally returns the next_vnode as the coordinates of the corner of the next track-sector (line 24).
Algorithm 3 determines the next forward direction of the query message from the current sensor node. According to the itinerary traversal algorithm, the forward direction is determined to be east if the current track index is an odd number, and west if even (lines 1-8). If the current track-sector is the last sector or the margin track, the forward direction is determined to be north because the algorithm does not need to select the Q-node (line 9). , is a query sector or a margin sector. If the track-sector has an odd-number sector, it is a query sector (lines 1-9). However, if the total number of sectors is an odd number and the current track-sector is the last sector, it is determined to be a margin sector because two consecutive sectors that are the first and the last sectors cannot be query sectors (lines 3-5).

Algorithm 4 Determining the Sector Type
IsSelectTrackSector ( , ) ⦁Input: a track index , a sector index ⦁Output: a Boolean value representing whether this TS is in a query sector or in a margin sector 1: ←calculate the total number of tracks 2: ←calculate the total number of sectors in the current track 3: if ( is an odd number) 4: if ( is an odd number & ≠ ) 5: ; //current track-sector is in a query sector 6: else 7: if ( is an odd number) 8: ; //current track-sector is in a query sector 9: return false; //current track-sector is in a margin sector

Performance Evaluation
In this section, we evaluate the performance of the proposed method in terms of energy efficiency, query latency, and query accuracy. We use the ns-2 simulator [21] for our experiments. We observe the impact of the constraint parameters, such as and , on the performance.

Experimental Settings
For the performance evaluation, we compare the proposed method with a post processing based method using the NN query. The post processing method collects all sensor nodes within the -NNB using the DIKNN method [13] and selects number of -distant sensor nodes from the collected sensor nodes. We call the post processing method DIKNN in our experiments.
The proposed method and DIKNN are implemented based on the ns-2 simulator. For the routing protocol in sensor networks, we use the geo-routing protocol GPSR [19] in the ns-2. The sensor nodes are randomly distributed in the wireless sensor networks. The movement pattern of the sensor nodes is represented by the random waypoint model (RWP). Each sensor moves to the arbitrary destination at a random speed ranging from 0 to 20. We fix the network size at 300 × 300 m . We vary the number of sensor nodes from 300 to 1000, and the node degree (i.e., neighbor count of each sensor node) ranges from 5 to 20. The distance between the source node and the home node for each query is set to 250 m. The query response size of each sensor nodes is 10 bytes. The performances are obtained by averaging the result over 10 simulation runs. Table 1 summarizes the datasets used for the experiments. Query latency is measured as the elapsed time between when the query is issued by the query point and when query responses are returned. Energy consumption is measured as the total amount of consumed energy during the query processing in the wireless sensor networks. Query accuracy is measured as the set similarity of distance between the ground truth and the proposed method. We use the Hausdorff distance algorithm [22] for the set similarity. Given two result sets of -NN, = { , , … , } and = { , , … , } , the Hausdorff distance calculates set similarity as in Equation (5), where is the distance from sensor node to the home node: Figure 6 shows the results for the -NN query accuracy compared with the ground truth. The left figure shows the accuracy with various values, such as 10 m, 20 m, 30 m, 40 m and 50 m in the D-300 dataset when is set to 30. The -NN achieves the highest query accuracy when is set to 30 m. This is because our method is a greedy algorithm. A small generates a large number of query result sets because many sensor nodes satisfy the condition of being distances apart. Therefore, the selected result set has a high probability of being different from the ground truth. In the case of a large , only a small number of result sets are possible. However, the accuracy decreases because the large increases the width of each track-sector.

Experimental Results
The right figure shows the results for the query accuracy with various datasets, such as D-300, D-500, and D-1000 when and are set to 30 m and 30, respectively. As the number of total sensor nodes increases, the query accuracy decreases. This result is related to the densities of the datasets. A dataset with high density includes a large number of result sets satisfying -NN. Therefore, the selected result set has a high probability of being different from the ground truth.  Figure 7 shows the results for the query accuracy and latency with various network sizes when the number of nodes, and are 300, 30 m and 30, respectively. As a network size increases, the query accuracy decreases, but the query latency increases. This performance degradation is because the larger network has sparser regions, where a sparse region has a few number of sensor nodes. Therefore, the l-kNN algorithm selects sensor nodes whose distance is larger than the ground truth. Similarly, the query latency shows a similar trend to the query accuracy because the average number of transmissions increases in the large network.  As the moving speed increases, the query accuracy decreases. When the moving speed is faster, the selected sensor has a larger distance compared with the ground truth. This is because the selected Q-nodes moves to arbitrary points fast during next Q-nodes are selected. The right figure shows the query latency. The query latency increases rapidly when the moving speed is faster than 30 m/s. This is because the average number of transmissions increases when the moving speed is fast.  Figure 9 shows the results of query latency between DIKNN and -kNN for D-300. When the constraint parameters l and k are sufficiently large, the -NN obtains better performance than the DIKNN. When l is smaller than or equal to r ( = 10 m), -NN is slower than DIKNN. This is because DIKNN broadcasts only one time to all sensor nodes within the sensor radio range, but -NN broadcasts / times. When is larger than ( = 20 m and = 30 m), -NN is faster than DIKNN because DIKNN each time broadcasts, but -NN disseminates the query message to a small number of sensor nodes with GPSR in the -NNB. For large enough , -NN is faster than DIKNN when is larger than . This explanation is similar to that for the results of . A large k leads DIKNN to perform many broadcasts.  Figure 10 shows the results for the energy consumption of -NN with various values of and for D-300. When is equal to , DIKNN consumes less energy than -NN. However, when is larger than , DIKNN consumes more energy than DIKNN. For large enough , DIKNN consumes more energy than -NN when is larger than . These results occur for similar reasons as for the query latency results. When is larger than , DIKNN disseminates the query messages to more sensor nodes than -NN does, and vice versa.

Conclusions
In this paper, we proposed a solution, the -NN, for the novel spatial query problem in mobile sensor networks. The query result implies well scattered objects nearest to the area of interest. The -NN approach can be used in most NN applications if we want to get well distributed or wide coverage of the NN result. -NN divides the search space into several track-sectors in which all sides are equal to or larger than the distance constraint . By selecting Q-nodes in alternating track-sectors, we have guaranteed distances between any two Q-nodes. To maintain the distance tightly, we adjusted the central angles and radii of the track-sectors. We also adopted parallel computing for query dissemination to reduce query latency. Through comprehensive experiments, we showed that the proposed algorithm exhibits superior performance compared with a post-processing based method using the NN query in terms of energy efficiency, query latency, and accuracy.