## 3 \(l\)-\(k\)-Nearest-Neighbors Query Processing
### \(l\)-\(k\)NN Query Dissemination  
After \(l\)-\(k\)NNB is determined, the query message is progressively disseminated from the H-node to the circumference of \(l\)-\(k\)NNB. Tracks are extended from the H-node to \(l\)-\(k\)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 \(l\)-\(k\)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 \(\theta_{i}\) and the number of sectors \(n_{i}\) 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 chords than \(l\), leading to low quality query results because the size of margin sectors is determined too loosely. Consider an H-node with coordinates \(H(a,b)\) and any margin track \(T_{i}\) centered at \(H\) with radius \(l\). \(T_{i}\) is sequentially divided into several sectors from the baseline \(y=b\) in the counterclockwise direction. The central angle \(\theta_{i}\) and the number of sectors \(n_{i}\) are determined depending on the distance constraint \(l\). We have a well-known equation involving a central sector, a radius, and a chord as in Equation (4):  
\[radius\times sin\left(\frac{\theta}{2}\right)=\frac{1}{2}\times chord \tag{4}\]  
Because we want all sides of each track sector to have length \(l\), \(\theta_{i}\) is calculated as \((l\times i)\times sin\left(\frac{\theta_{i}}{2}\right)=\frac{1}{2}\times l\). We can also calculate \(n_{i}\) as \(n_{i}=\frac{2\pi}{\theta_{i}}\). When a track is divided into sectors in the counterclockwise direction, the last sector has a central angle smaller than \(\theta\). 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 \(l\). 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 \(l\) because that of a lower chord is \(l\). Therefore, the Q-node is selected aroundthe inner corner intersecting the lower arc and the margin sector in order to keep the \(l\) distance constraint tight. In a track-sector of a margin track, an upper chord is \(l\), and a lower chord is shorter than \(l\). 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 \(r\) rather than \(l\), when \(r\) is shorter than \(l\). If we set the radii of query and margin tracks to the same distance \(l\), the average distance between Q-nodes is \(2\times l\). By using \(r\) for the radii of query tracks and chords of query sectors, the distance is reduced by \(2\times l\) to \(r+l\). Figure 4 shows an example for calculating the number of sectors. \(\theta_{1}\) is calculated as \(l\times sin\left(\frac{\theta_{1}}{2}\right)=\frac{l}{2}\), and \(n_{1}=\frac{2\pi}{\theta_{1}}\), in the first track. In the third track, \(\theta_{2}\) is calculated again as \((l\times 3)\times sin\left(\frac{\theta_{2}}{2}\right)=\frac{l}{2}\), where \(\theta_{1}>\theta_{2}\). The second and fourth tracks are query tracks. Q-nodes are then selected in \(TS_{2,1}\), \(TS_{2,3}\), \(TS_{2,5}\), \(TS_{4,1}\), \(TS_{4,3}\), \(TS_{4,5}\), \(TS_{4,7}\), and so on. In the following, we explain how the query message is disseminated. In a \(k\)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 \(l\)-\(k\)NN problem, we do not need to traverse all sensor nodes.