I have two sets:
$$P = \{p_1, p_2, ..., p_n\}$$
$$Q = \{q_1, q_2, ..., q_m\}$$
For each $p_i$ point I need to find all nearest points in $Q$.
I.e.,
$$p_i \rightarrow \{ q_{i_1}, q_{i_2}, ..., q_{i_k} \}, 1 \leq i \leq n$$
where $d(p_i, q_{i_j}) = min\{d(p_i, q_l) : q_l \in Q\}$.
I'm searching for the fastest algorithm to do this.
I'm working in two-dimensional euclidean space.
Would using k-D tree be efficient for this case?
And another question,we can treat this problem as $n$ independent problems, and for each point from $P$ find nearest points in $Q$, but in wikipedia article, in All nearest neighbors section it's written that n improved strategy would be an algorithm that exploits the information redundancy between these $n$ queries to produce a more efficient search. Where can I find such algorithm(any links maybe)?
Thanks in advance.
Here is a somewhat efficient approach:
$Q_i = \{q\in Q \mid d(p_i,q) = d_i\}$. We'll build these on-the-fly
This will work especially good if some $p$ are clustered together so that they have the same nearest neighbors. If they are all random, it will at least help migitate some re-initialisations of the set $Q_i$ (wich should be the most expensive of all operations)