sdd/kiddo

Clear Float KdTree

Closed this issue · 4 comments

Hi @sdd, thanks for the great work! I'm wondering if there's a way to clean all the nodes from a KdTree without iterating through. Thanks so much!

sdd commented

Thanks @DawChihLiou! No, there is no specific method for that. It would be pretty straight forward to add one though. What are you trying to achieve with this?

I came across a use case where users deleted documents in bulk and sometimes an entire k-d tree became invalid because all the reference data were deleted and the nodes were pointing nowhere. So I'm exploring a less expensive removal to clean the tree. Would it be more straightforward just to instantiate a new tree in this case?

sdd commented

Yes, in this case it would certainly be better to rebuild the tree. Removal of items is implemented in a very basic way - there is no rebalancing of the tree performed on removal.

Will you consider implement rebalancing on removal? Removal happens quite frequently and maintaining query performance would be something my clients love to see.