|
|
|
| BPTree () |
| | Default constructor.
|
| |
|
| BPTree (BPTree &&other) noexcept |
| | Default move constructor.
|
| |
|
| BPTree (const BPTree &)=delete |
| | Deleted copy constructor.
|
| |
|
| ~BPTree () |
| | Default destructor.
|
| |
|
|
BPTree & | operator= (BPTree &&other) noexcept |
| | Default move assignment operator.
|
| |
|
|
PostorderIterator | get_postorder_iterator_begin () const |
| | Return an iterator pointing to the first node in postorder traversal.
|
| |
|
PostorderIterator | get_postorder_iterator_end () const |
| | Return an iterator pointing to the end of postorder traversal.
|
| |
|
ValueForwardIterator | get_value_forward_iterator_begin () const |
| | Return an iterator pointing to the first value in the values S[0..n-1].
|
| |
|
ValueForwardIterator | get_value_forward_iterator_end () const |
| | Return an iterator pointing to the end of the values S[0..n-1].
|
| |
|
LeafForwardIterator | get_leaf_forward_iterator_begin () const |
| | Return an iterator pointing to the first leaf in forward traversal.
|
| |
|
LeafForwardIterator | get_leaf_forward_iterator_end () const |
| | Return an iterator pointing to the end of forward leaf traversal.
|
| |
|
|
const std::vector< NodePointer > & | get_temporary_path () const |
| | Returns the path computed by the last search operation.
|
| |
|
uint64_t | get_max_degree_of_internal_node () const |
| | Return MAX_DEGREE.
|
| |
|
uint64_t | get_split_process_counter () const |
| | Return the number of split operations performed internally.
|
| |
|
uint64_t | size () const |
| | Return the number of values stored in this tree (i.e., n).
|
| |
|
uint64_t | capacity () const |
| | Return the number of values that can be stored in this tree without resizing the vector that stores LEAF_CONTAINER instances.
|
| |
|
double | get_value_density () const |
| | Return the density of this tree (i.e., n / capacity()).
|
| |
|
uint64_t | get_max_count_of_values_in_leaf () const |
| | Return LEAF_CONTAINER_MAX_SIZE.
|
| |
|
uint64_t | height () const |
| | Return the height of this tree.
|
| |
|
uint64_t | get_leaf_count () const |
| | Return the number of leaves in this tree (i.e., y).
|
| |
|
uint64_t | get_leaf_container_vector_size () const |
| | Return the size of the vector that stores LEAF_CONTAINER instances.
|
| |
|
bool | empty () const |
| | Return true if n = 0, false otherwise.
|
| |
|
LEAF_CONTAINER & | get_leaf_container (uint64_t i) |
| | Returns a reference to the LEAF CONTAINER at position i in the vector leaf_container_vec.
|
| |
|
const LEAF_CONTAINER & | get_leaf_container (uint64_t i) const |
| | Returns a const reference to the LEAF CONTAINER at position i in the vector leaf_container_vec.
|
| |
| uint64_t | size_in_bytes (bool only_dynamic_memory=false) const |
| | Returns the total memory size of this B+-tree.
|
| |
|
BPTree * | get_linked_tree () const |
| | Gets the B+ tree linked to this instance.
|
| |
|
|
std::vector< VALUE > | to_value_vector () const |
| | Return the values S[0..n-1] as a vector of VALUE.
|
| |
|
| VALUE | at (uint64_t i) const |
| | Return B[i].
|
| |
| uint64_t | get_value_index (uint64_t leaf_index_j, uint64_t position_in_leaf_container_p) const |
| | Returns the index i of the value S[i] stored in the LEAF CONTAINER W[j] as the (p+1)-th value.
|
| |
| uint64_t | psum () const |
| | Return the sum of the weights of S[0..n-1].
|
| |
| uint64_t | psum (uint64_t i) const |
| | Return the sum of the weights of S[0..i].
|
| |
| int64_t | search (uint64_t u) const |
| | Return the smallest index i such that psum(i) >= u if it exists, otherwise return -1.
|
| |
| int64_t | select0 (uint64_t i) const |
| | Returns the position of the (i+1)-th 0 in S[0..n-1] if it exists, otherwise return -1.
|
| |
| void | get_path_from_root_to_first_leaf (std::vector< NodePointer > &output_path) const |
| | Compute the path from the root to the first leaf, and store it in the output_path.
|
| |
| void | get_path_from_root_to_last_leaf (std::vector< NodePointer > &output_path) const |
| | Compute the path from the root to the last leaf, and store it in the output_path.
|
| |
| int64_t | compute_path_from_root_to_leaf (uint64_t i) const |
| | Compute the path from the root to the leaf containing S[i], and return the position of S[i] in the LEAF CONTAINER of the leaf.
|
| |
| int64_t | compute_path_from_root_to_leaf (uint64_t i, std::vector< NodePointer > &output_path) const |
| | Compute the path from the root to the leaf containing S[i], store it in the output_path, and return the position of S[i] in the LEAF CONTAINER of the leaf.
|
| |
| bool | check_if_leaf_container_vec_is_sorted () const |
| | Checks if the leaf containers are sorted in the vector W, i.e., W[i] is the leaf container of the i-th leaf.
|
| |
|
| std::vector< std::string > | get_memory_usage_info (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
| | Return the memory usage information of this data structure as a vector of strings.
|
| |
| void | print_memory_usage (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
| | Print the memory usage information of this data structure.
|
| |
|
void | print_tree () const |
| | Prints the B+ tree in a tree-like format.
|
| |
|
void | print_info (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
| | Prints detailed information about the B+ tree.
|
| |
|
void | print_leaves () const |
| | Prints the leaves of the B+ tree.
|
| |
|
void | print_internal_nodes () const |
| | Print the internal nodes of this B+ tree.
|
| |
|
void | print_leaf_containers () const |
| | Prints the leaf containers of the B+ tree.
|
| |
| void | print_information_about_performance (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
| | Print the performance information of this data structure.
|
| |
| void | print_statistics (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
| | Print the statistics of this data structure.
|
| |
|
void | print_debug_info () const |
| | Print debug information about this instance.
|
| |
|
bool | verify () const |
| | Verify the internal consistency of this data structure.
|
| |
|
|
void | initialize () |
| | Initializes this instance.
|
| |
| void | swap (BPTree &_tree, bool swap_linked_tree=true) |
| | Swap operation.
|
| |
|
void | clear () |
| | Clear the B+-tree and reset it to an empty state (i.e., n = 0, x = 0, y = 0).
|
| |
| void | push_back (VALUE value) |
| | Push a given value to the end of the sequence S.
|
| |
| void | push_many (const std::vector< VALUE > &values_Q) |
| | Add a given sequence Q[0..k-1] to the end of S[0..n-1] (i.e., S = S[0..n-1]Q[0..k-1])
|
| |
| void | push_front (VALUE value) |
| | Push a given value to the beginning of the sequence S.
|
| |
| uint64_t | remove_using_path (const std::vector< NodePointer > &path, uint64_t position_in_leaf_container_q) |
| | Remove S[i] from the sequence S using (i) the path from the root to the leaf containing S[i] and (ii) the position q of S[i] in the LEAF CONTAINER of the leaf.
|
| |
| void | remove (uint64_t i) |
| | Remove S[i] from the sequence S.
|
| |
| void | insert (uint64_t i, VALUE v, uint64_t weight_w) |
| | Insert a given value v with weight w at position i in the sequence S.
|
| |
| void | increment (uint64_t i, int64_t delta) |
| | Update S[i] and its weight using a given value delta and the increment function supported by the LEAF CONTAINER.
|
| |
| void | resize (uint64_t _size, VALUE default_value) |
| | Change the size of the sequence S to a given integer _size. If we need push a new value to S, then the value is initialized with default_value.
|
| |
| void | set_linked_tree (BPTree *_tree) |
| | Sets a given BPTree instance to be linked to this instance.
|
| |
| void | sort_leaf_containers () |
| | Sorts the leaf containers so that each W[i] is the LEAF CONTAINER of the i-th leaf.
|
| |
| void | build (const std::vector< VALUE > &_values) |
| | Builds the B+ tree so that S[0..n-1] = _values[0..n-1].
|
| |
template<typename LEAF_CONTAINER, typename VALUE, uint64_t MAX_DEGREE, uint64_t LEAF_CONTAINER_MAX_SIZE, bool USE_PARENT_FIELD, bool USE_PSUM>
class stool::bptree::BPTree< LEAF_CONTAINER, VALUE, MAX_DEGREE, LEAF_CONTAINER_MAX_SIZE, USE_PARENT_FIELD, USE_PSUM >
An implementation of a B+-tree for storing n values S[0..n-1] of type VALUE in leaves.
The details of this B+-tree is as follows:
- This B+-tree consists of
x internal nodes and y leaves.
- Every internal node has at most
MAX_DEGREE children. The number of the children is at least MAX_DEGREE / 2 if n is sufficiently large.
- Every leaf is an
LEAF_CONTAINER instance that stores at most LEAF_CONTAINER_MAX_SIZE values. The number of these values is at least LEAF_CONTAINER_MAX_SIZE / 2 if n is sufficiently large.
y LEAF_CONTAINER instances are stored in a vector W[0..z-1], where z = Ω(y)
- Each value
S[i] can have a weight w(i). If USE_PSUM is true, the prefix sum of the weights of S[0..i-1] can be computed in O(\log n) time.