LAL: Linear Arrangement Library 23.01.00
A library focused on algorithms on linear arrangements of graphs.
|
Node of the tree. More...
Public Member Functions | |
std::size_t | left_size () const noexcept |
Returns the size of the left subtree. | |
std::size_t | right_size () const noexcept |
Returns the size of the right subtree. | |
std::size_t | left_counter () const noexcept |
Returns the total occurrences of the left subtree. | |
std::size_t | right_counter () const noexcept |
Returns the size of the right subtree. | |
void | update_height_and_balance_factor () noexcept |
Calculate the height and balance factor of this node. More... | |
void | update_size () noexcept |
Computes the size of the subtree rooted at this node. More... | |
void | update_count () noexcept |
Computes the size of the subtree rooted at this node. More... | |
void | update () noexcept |
Updates information of this node. More... | |
void | replace_with (tree_node *n) noexcept |
Replace this node with either its left or right child. More... | |
Public Attributes | |
T | key |
contents of the node | |
std::size_t | node_counter = 0 |
Amount of occurrences of key. | |
std::size_t | tree_size = 0 |
Amount of nodes in the subtree rooted at this node. More... | |
std::size_t | tree_counter = 0 |
Total number of occurrences in the nodes in the subtree rooted at this node. More... | |
std::size_t | height = 0 |
Maximum height of the left and right subtrees' height. | |
int64_t | balance_factor = 0 |
Balance factor of a node: More... | |
tree_node * | parent = nullptr |
Pointer to the parent of this node. | |
tree_node * | left = nullptr |
Pointer to the left subtree. | |
tree_node * | right = nullptr |
Pointer to the right subtree. | |
char | side = '0' |
Side of this node with respect to its parent. More... | |
Node of the tree.
|
inlinenoexcept |
Replace this node with either its left or right child.
Let p := this->parent be the parent of "this" node. That is, the grandparent of parameter n.
If this node is a left child of 'p', make 'n' be the left child of 'p'. If it is a right child of 'p', make 'n' be the right child of 'p'.
n | Left or right child of this node. |
|
inlinenoexcept |
Updates information of this node.
|
inlinenoexcept |
Computes the size of the subtree rooted at this node.
|
inlinenoexcept |
Calculate the height and balance factor of this node.
|
inlinenoexcept |
Computes the size of the subtree rooted at this node.
int64_t lal::detail::AVL< T >::tree_node::balance_factor = 0 |
Balance factor of a node:
Right subtree's height minus left subtree's height. This value is either -2, -1, 0, 1, 2.
char lal::detail::AVL< T >::tree_node::side = '0' |
Side of this node with respect to its parent.
l: this node is a left subtree of its parent, r: this node is a right subtree of its parent, 0: this node is the root. Eq. parent = nullptr
std::size_t lal::detail::AVL< T >::tree_node::tree_counter = 0 |
Total number of occurrences in the nodes in the subtree rooted at this node.
Sum of the occurrences at this node plus the sum of the occurrences across all nodes of the left subtree plus the sum of the occurrences across all nodes of the right subtree.
This is not necessarily the same as tree_size.
std::size_t lal::detail::AVL< T >::tree_node::tree_size = 0 |
Amount of nodes in the subtree rooted at this node.
Number of nodes in the left and right subtrees plus this node.