Skip to content
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

Support removing deleted entries from tree #30

Open
andrewherren opened this issue Apr 3, 2024 · 0 comments
Open

Support removing deleted entries from tree #30

andrewherren opened this issue Apr 3, 2024 · 0 comments

Comments

@andrewherren
Copy link
Collaborator

Currently, the tree class handles pruning by marking nodes as "deleted" and thus available for reallocation. This is helpful during training / sampling since the tree class largely consists of vectors and with std::vector, element removal is O(N) but element insertion is (amortized) O(1).

When a tree is done sampling (potentially ready for serialization), it would be nice to re-organize the tree class by removing deleted nodes and renumbering the nodes that remain in the tree::parent_, tree::cleft_, and tree::cright_ vectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant