First we present the proof that our algorithm answers the NN queries by accessing minimum number of cells and then we compare it with CPM.
Proof of optimality and correctness: Given a query , in our continuous NN algorithm, the minimal set of cells are all accessed and only these cells are accessed.4.
Proof
Let be the distance of nearest neighbor from before the update and be the distance of nearest neighbor after the result has been updated. For the case, when , our algorithm updates the results without accessing any cell (i.e., in case when number of incoming updates is greater than outgoing updates). So we only consider the case when .
First we identify the minimal set of cells that has to be accessed in order to guarantee the correctness then we will show that our algorithm does not access any cell .
Corollary 1: Only the cells that has can contain the new nearest neighbor.
Corollary 2: Only the cells that has can contain the new nearest neighbor.
From corollaries 1 and 2, it can be inferred that the minimal set of cells is , such that for all , and .
First we show that our algorithm does not access any unnecessary cell. To update the results, our algorithm starts by calling CircularTrip with radius . As the radius of subsequent calls to CircularTrip is always greater than , it can be immediately verified that no cell can be returned such that (satisfies corollary ). Moreover, our algorithm accesses cells in strictly ascending order and stops as soon the next cell has (satisfies corollary ).
Now as a proof of correctness we show that our algorithm accesses all the cells in minimal set of cells . The algorithm starts by calling CircularTrip with radius and the cells that have are retrieved. Algorithm iteratively calls CircularTrip with radius increased by unless NNs are found. According to lemma , this increment of guarantees that no cell is missed.
Note that initial computation can be considered a special case of update handling where is zero.
As compared with CPM, our CircularTrip-based algorithm has following advantages.
To illustrate that CPM accesses unnecessary cells during update handling, we present a concrete example in Fig. , where update handling of a NN query is shown. Fig. shows the initial computation of where the result is . The light-shaded cells are accessed during this computation and form the visit list. The dark-shaded cells and four rectangles ( and ) are the entries in heap after the initial results have been computed by CPM..
[A -NN query evaluated by CPM] [ is deleted, is updated result ] |
Consider an update deletes the object , CPM cannot update the result by starting from the heap because the new result is in visit list (a cell that was deheaped from ). In order to update the results, CPM first needs to access all the cells in visit list and then it continues with heap . It stops when the next entry (cell or rectangle) in heap has . Fig. shows the update of the results. During this update, CPM accesses light-shaded cells of Fig. . The heap contains the dark-shaded cells and four rectangles ( and ) after the result has been updated.
Fig. shows the update handling of the same query by our CircularTrip based algorithm. When is deleted, our algorithm calls CircularTrip with radius set as as shown by dotted circle in Fig. . The new result is found and the algorithm calls CircularTrip with radius just to confirm that it does not miss any result. The algorithm accesses only the shaded cells of Fig. and it can be seen that number of cells accessed by our algorithm is much smaller than that of CPM (compare the light-shaded cells of Fig. and Fig. .
[A -NN query] [ is deleted from and is added] |
The size of both the visit list and search heap never decreases unless reports location update in which case both the visit list and heap are deleted. Even when the influence region is shrunk, the size of visit list and heap remains unchanged. On the other hand, when the influence region expands the visit list and heap also expand.
Muhammad Aamir Cheema 2007-10-11