python - Efficient nearest neighbour search when list is growing? -
i've been rewriting old maze type thing did fun, though instead of being maze it's bit more abstract , shrinks down, can't if location in locations search. i've done basic nearest neighbour search , have tried optimise little, it's still slow, in every 10x more nodes, 1000x more calculations needed (167 billion @ 10,000 nodes, collision checking), don't think there's more can done this. here's code edited work itself, nodes class , iterate through each 1 , grab size/location attribute (changed node[0] , node[1] ). imagine node_list has thousands of values. dimensions = 3 dimensions_range = range(dimensions) def collision_check(node_list, location, size, bounds=none): #check new node within bounds (if set) if bounds: in dimensions_range: if not bounds[0][i] + size <= location[i] <= bounds[1][i] - size: return true #find if nodes overlapping node in node_list: size_total = siz...