-
Notifications
You must be signed in to change notification settings - Fork 4
Implement KD Tree indexer #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: refactor
Are you sure you want to change the base?
Conversation
270fee6 to
fb0573d
Compare
crates/index/src/kd_tree/index.rs
Outdated
| self.check_and_rebalance(&path); | ||
| } | ||
|
|
||
| // Rebuild helper methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shift the helper methods to different file
crates/index/src/kd_tree/types.rs
Outdated
| pub left: Option<Box<KDTreeNode>>, | ||
| pub right: Option<Box<KDTreeNode>>, | ||
| pub is_deleted: bool, | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add axis field in the node itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough
crates/index/src/kd_tree/types.rs
Outdated
| #[derive(Debug, Clone, PartialEq)] | ||
| pub struct Neighbor { | ||
| pub id: PointId, | ||
| pub distance: f32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer
I added this type for usage in binaryheap, see if it is of any use here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, used same type in Neighbor definition
| pub const DELETE_REBUILD_RATIO: f32 = 0.25; | ||
|
|
||
| /// Checks if a node is unbalanced based on the balance threshold | ||
| pub fn is_unbalanced(node: &KDTreeNode) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have these helpers as impl for KDTreeNode{}.
No description provided.