Assuming euclidean distance, how I can I find things nearby to a set of starts for a bunch of objects?
The best I can think of is n2 log n (running Dijkstra for each individual thing), which seems incredibly slow and problematic for what I'm trying to do. This problem, for context, is that I have these objects in a DB, and I need to load what is nearby on a semi-often basis. I abstracted the problem away to the following problem.
input:
possibleStarts: [(2,3), (5,7), (7,9)]
possibleObjects: [(5,4),(1,3), (7,8), (1,4) ]
output:
{
(2,3): [(1,3), (1,4), (5,4), (7,8)],
(5,7): [(5,4), (7,8), (1,4), (1,3)],
(7,9): [(7,8), (5,4), (1,4), (1,3)]
}
if at all applicable, I am using Firestore