In python, given S, a dataset (of 2D points) and T a subset of it. I find the nearest neighbours of T in S with cKDTree:
tree = cKDTree(S)
distances, indices = tree.query(T,2)
Now, my dataset is growing with time, so say I have accumulated an extra dataset S2 and I need to know the nearest neighbours of T2 (subset of S2) in the entire dataset, which is now the union of S & S2.
I'm searching for a way to update 'tree' for S2 rather than recomputing it on the entire dataset everytime again. Alternatively, computing a tree on S2 and merging the trees would do the trick as well I suppose...
NB: in my case, usually T2 has just 1 point, whereas S & S2 are rather large (hundreds to hundred thousands).