|
CMMTree v1.0
|
The Conditional Multiway Mapped Tree (CMMTree) class definition. More...
#include <cmmtree.hpp>
Public Member Functions | |
| CMMTree () | |
| Dfefault constructor. | |
| CMMTree (std::vector< X1 >const *const &adr) | |
| Single-argument constructor. | |
| CMMTree (std::vector< X1 >const *const &adr, typename std::vector< X1 >::const_iterator const &pos) | |
| Two arguments constructor. | |
| CMMTree (const CMMTree< X1, predicate > &)=delete | |
| Copy constructor. Construct of copies of CMMTree object is prohibited. | |
| CMMTree< X1, predicate > & | operator= (const CMMTree< X1, predicate > &)=delete |
| Copy assignment operator. Copying a CMMTree object using the assignment operator is not allowed. | |
| CMMTree (CMMTree &&other) noexcept | |
| Move constructor. | |
| auto | operator= (CMMTree &&other) noexcept -> CMMTree< X1, predicate > & |
| Move assignment operator. | |
| ~CMMTree () | |
| Destructor. The allocated memory for all nodes in the tree is released. | |
| void | create_subtrees_roots (std::vector< X1 > const &roots_data) |
| This function allows you to initialize the creation of a forest using a separate data set - different from the main input data set. | |
| void | join_data (std::vector< X1 >const *const &adr) |
| This function is used to connect the CMMTree object to the input data vector. | |
| void | join_data (std::vector< X1 >const *const &adr, typename std::vector< X1 >::const_iterator const &pos) |
| This function is used to connect the CMMTree object to the input data vector. | |
| long long | tree_create () |
| A function that starts the process of the CMMTree construction. | |
| predicate< X1 > & | pred_value () |
| A function that allows you to modify the value of a predicate object. | |
| predicate< X1 > const & | pred_value () const |
| A function that allows you to read the value of a predicate object. | |
| X1 const & | firstborn_value (size_t i, size_t j) const |
| A function that allows you to read the value of [i,j]-th firstborn node. | |
| size_t | all_nodes_number () const |
| This function returns the number of all nodes in the CMMTree. | |
| size_t | firstborns_number (size_t i) const |
| This function returns the number of firstborn nodes of one generation of the CMMTree - at the level passed by the argument (i). | |
| size_t | leaves_number (size_t i) const |
| This function returns the number of leaves one generation of the CMMTree - at the level passed by the argument (i). | |
| size_t | generation_size (size_t i) const |
| This function returns the total number of nodes one generation of the CMMTree - at the level passed by the argument (i). | |
| size_t | tree_height () const |
| This function returns the CMMTree height. | |
| void | generation_addresses (size_t i, std::vector< const node< X1 > * > &vec) const |
| This function allows you to get all the addresses of the i-th generation firstborn nodes. Firstborn nodes addresses - at the level passed by the first argument. | |
| void | generation_addresses (size_t i, std::vector< node< X1 > * > &vec) const |
| This function allows you to get all the addresses of the first-born nodes of the i-th generation, using which you will be able to remove the selected nodes. Firstborn nodes addresses - at the level passed by the first argument. | |
| void | leaves_addresses (size_t i, std::vector< const node< X1 > * > &vec) const |
| This function allows you to get all the addresses of the i-th generation leaves. | |
| const node< X1 > * | brother_address (const node< X1 > *ptr, size_t i) const |
| This function allows you to obtain the address of the i-th brother of the firstborn node. | |
| node< X1 > const *const & | firstborn_address (size_t i, size_t j) const |
| The function returns the address of the j-th firstborn of the i-th generation. | |
| std::vector< X1 > const *const & | P_dataset () const |
| The function returns the address of the input data vector. | |
| void | delete_one_node (node< X1 > *&to_del) |
| This function deletes the node whose address is passed as an argument. | |
| void | delete_nodes (std::vector< node< X1 > * > &to_del, size_t lev) |
| Using this function you can delete more than one node from a specified node generation at once. | |
| void | tree_clear () |
| This function clears the entire CMMTree object. | |
| void | tree_shape (std::ostream &out) const |
| This function allows you to represent a tree in a parametric form. | |
Friends | |
| template<class T1 , template< typename > class T2> | |
| std::ostream & | operator<< (std::ostream &out, CMMTree< T1, T2 > const &ref) |
| Overloaded output operator to the stream. | |
The Conditional Multiway Mapped Tree (CMMTree) class definition.
| X1 | - a type parameter, that is, the type of input data being processed. |
| predicate | - a type template parameter representing the predicate class template, which is parameterized by the first parameter (X1) of the CMMTree class template. |
More information - see: https://ieeexplore.ieee.org/document/9069220
Definition at line 20 of file cmmtree.hpp.
|
inline |
Dfefault constructor.
If you use it then:
Definition at line 43 of file cmmtree.hpp.
|
inline |
Single-argument constructor.
| adr | The address of the vector containing the input data. |
If you use it then:
Definition at line 57 of file cmmtree.hpp.
|
inline |
Two arguments constructor.
| adr | The address of the vector containing the input data. |
| pos | Iterator to the selected element of the input data vector. |
If you use it then:
Definition at line 72 of file cmmtree.hpp.
|
delete |
Copy constructor. Construct of copies of CMMTree object is prohibited.
|
inline |
Destructor. The allocated memory for all nodes in the tree is released.
Definition at line 127 of file cmmtree.hpp.
|
inline |
This function returns the number of all nodes in the CMMTree.
Definition at line 198 of file cmmtree.hpp.
|
inline |
This function allows you to obtain the address of the i-th brother of the firstborn node.
| ptr | Firstborn node address. |
| i | Brother number of the firstborn node. |
Definition at line 180 of file cmmtree.cpp.
| void CMMTree< X1, predicate >::create_subtrees_roots | ( | std::vector< X1 > const & | roots_data | ) |
This function allows you to initialize the creation of a forest using a separate data set - different from the main input data set.
| roots_data | A vector of values represented by the roots of subtrees.
|
Definition at line 59 of file cmmtree.cpp.
| void CMMTree< X1, predicate >::delete_nodes | ( | std::vector< node< X1 > * > & | to_del, |
| size_t | lev ) |
Using this function you can delete more than one node from a specified node generation at once.
NOTE:
| to_del | A vector of node addresses to be deleted. |
| lev | Tree level: <0, ..., tree_height()>. |
Definition at line 246 of file cmmtree.cpp.
| void CMMTree< X1, predicate >::delete_one_node | ( | node< X1 > *& | to_del | ) |
This function deletes the node whose address is passed as an argument.
NOTE:
| to_del | Address of the node to be deleted. |
Definition at line 223 of file cmmtree.cpp.
|
inline |
The function returns the address of the j-th firstborn of the i-th generation.
| i | Tree level: <0, ..., tree_height()>. |
| j | Firstborn number : <0, ..., MTree[i].size() ). |
Definition at line 188 of file cmmtree.cpp.
|
inline |
A function that allows you to read the value of [i,j]-th firstborn node.
| i | Tree level: <0, ..., tree_height()>. |
| j | The index of the element of the i-th firstborns vector <0,... , firstborns vector size>. |
Definition at line 190 of file cmmtree.hpp.
| size_t CMMTree< X1, predicate >::firstborns_number | ( | size_t | i | ) | const |
This function returns the number of firstborn nodes of one generation of the CMMTree - at the level passed by the argument (i).
| i | Tree level: <0, ..., tree_height()>. |
Definition at line 87 of file cmmtree.cpp.
|
inline |
This function allows you to get all the addresses of the i-th generation firstborn nodes.
Firstborn nodes addresses - at the level passed by the first argument.
| i | Tree level: <0, ..., tree_height()>. |
| vec | Reference to the vector< const node<X1>* >. |
Definition at line 122 of file cmmtree.cpp.
|
inline |
This function allows you to get all the addresses of the first-born nodes of the i-th generation, using which you will be able to remove the selected nodes.
Firstborn nodes addresses - at the level passed by the first argument.
| i | Tree level: <0, ..., tree_height()>. |
| vec | Reference to the vector< node<X1>* >. |
Definition at line 140 of file cmmtree.cpp.
| size_t CMMTree< X1, predicate >::generation_size | ( | size_t | i | ) | const |
This function returns the total number of nodes one generation of the CMMTree - at the level passed by the argument (i).
| i | Tree level: <0, ..., tree_height()>. |
Definition at line 110 of file cmmtree.cpp.
| void CMMTree< X1, predicate >::join_data | ( | std::vector< X1 >const *const & | adr | ) |
This function is used to connect the CMMTree object to the input data vector.
| adr | Address of the input data vector. |
If you use it then:
Definition at line 6 of file cmmtree.cpp.
| void CMMTree< X1, predicate >::join_data | ( | std::vector< X1 >const *const & | adr, |
| typename std::vector< X1 >::const_iterator const & | pos ) |
This function is used to connect the CMMTree object to the input data vector.
| adr | Address of the input data vector. |
| pos | Iterator to one of the elements of the input data vector. |
If you use it then:
Definition at line 12 of file cmmtree.cpp.
|
inline |
This function allows you to get all the addresses of the i-th generation leaves.
| i | Tree level: <0, ..., tree_height()>. |
| vec | Reference to the vector< const node<X1>* >. |
Definition at line 158 of file cmmtree.cpp.
| size_t CMMTree< X1, predicate >::leaves_number | ( | size_t | i | ) | const |
This function returns the number of leaves one generation of the CMMTree - at the level passed by the argument (i).
| i | Tree level: <0, ..., tree_height()>. |
Definition at line 94 of file cmmtree.cpp.
|
inlinenoexcept |
Move assignment operator.
| other | Object to be moved. |
Definition at line 108 of file cmmtree.hpp.
|
delete |
Copy assignment operator. Copying a CMMTree object using the assignment operator is not allowed.
|
inline |
The function returns the address of the input data vector.
Definition at line 281 of file cmmtree.hpp.
|
inline |
A function that allows you to modify the value of a predicate object.
Definition at line 175 of file cmmtree.hpp.
|
inline |
A function that allows you to read the value of a predicate object.
Definition at line 181 of file cmmtree.hpp.
| void CMMTree< X1, predicate >::tree_clear | ( | ) |
This function clears the entire CMMTree object.
If you use it then:
Definition at line 270 of file cmmtree.cpp.
| long long CMMTree< X1, predicate >::tree_create | ( | ) |
A function that starts the process of the CMMTree construction.
Use the function time_info(const unsigned long&, std::ostream& ) to see this time in µs and ms.
Definition at line 74 of file cmmtree.cpp.
|
inline |
| void CMMTree< X1, predicate >::tree_shape | ( | std::ostream & | out | ) | const |
This function allows you to represent a tree in a parametric form.
The results are passed to the stream object in CSV format. For more information on parametric description of tree shape, see the paper: https://ieeexplore.ieee.org/document/9069220
| out | Output stream object. |
Definition at line 283 of file cmmtree.cpp.
|
friend |
Overloaded output operator to the stream.
It allows you to look at the values of CMMTree nodes - that is, the values of the input data set (D).
These can be specific values of the input data set (D) objects or addresses of these objects - if the set (D) consists of addresses of other dynamically allocated objects.
The way the operator works depends on the values of two preprocessor directives (MAX_NODES_TO_PRINT and PRINT_ALL_PATHS) found in the main_xx.hpp file.
| out | Output stream object. |
| ref | CMMTree object. |