Tree class.
More...
#include <pruner.hpp>
|
void | eval_fun () |
| Evaluates the function by passing the arguments and the iterator.
|
|
| Tree (const v_uint &parents_, const v_uint &offspring_, uint &out) |
| Creating method using parents and offpring. More...
|
|
const vv_uint * | get_parents_ptr () const |
|
const vv_uint * | get_offspring_ptr () const |
|
const v_uint * | get_postorder_ptr () const |
|
vv_uint | get_parents () const |
|
vv_uint | get_offspring () const |
|
v_uint | get_postorder () const |
|
v_uint | get_preorder () const |
|
v_uint | get_tips () const |
| List of tips position indices.
|
|
v_uint | get_dist_tip2root () |
| Distance of tips to the closest root.
|
|
uint | n_nodes () const |
| Returns the numner of nodes.
|
|
uint | n_edges () const |
| Returns the numner of edges.
|
|
uint | n_tips () const |
| Return the number of tips defined as nodes with no offspring.
|
|
int | n_offspring (uint i) const |
| Return the number of offsprings a given node has.
|
|
int | n_parents (uint i) const |
| Return the number of parents a given node has.
|
|
vv_uint | get_edgelist () const |
|
void | print (bool details=true) const |
|
bool | is_dag () |
|
bool | is_connected () const |
|
void | reset_visited () |
|
uint | set_postorder (const v_uint &POSTORDER_, bool check=true) |
|
void | prune_postorder () |
| Do the tree-traversal using the postorder. More...
|
|
void | prune_postorder (v_uint &seq) |
| Do the tree-traversal using the postorder with a user specific sequence. More...
|
|
void | prune_preorder () |
| Do the tree-traversal using the preorder. More...
|
|
void | prune_preorder (v_uint &seq) |
| Do the tree-traversal using the preorder with a user specific sequence. More...
|
|
|
Data_Type * | args = nullptr |
| Arbitrary set of arguments.
|
|
std::function< void(Data_Type *, TreeIterator< Data_Type > &)> | fun |
| Callable function during the the tree traversal. More...
|
|
|
bool | is_dag_ (int i=-1, int caller=-1, bool up_search=false) |
|
void | postorder_ (uint i) |
|
void | postorder () |
|
uint | get_dist_tip2root_ (uint start, uint count) |
|
|
class | TreeIterator< Data_Type > |
|
template<typename Data_Type = bool>
class pruner::Tree< Data_Type >
Tree class.
Arguments to be passed to Tree::fun. The Tree class is the core of pruner. The most relevant members are
parents
offspring
iterator
args
fun
- Examples:
- 00-hello-world.cpp, 01-adding-function.cpp, and 02-rcpp.cpp.
template<typename Data_Type >
Creating method using parents and offpring.
The tree is initialized using an edgelist by listing each edges' parent and offspring. The ids of the nodes must range 0 through n - 1
.
- Parameters
-
parents_ | Ids of the parents |
offspring_ | Ids of the offspring. Must be of the same length as parents_ |
out | Return codes. 0 means success. |
template<typename Data_Type >
void Tree< Data_Type >::prune_postorder |
( |
| ) |
|
|
inline |
Do the tree-traversal using the postorder.
The user defined function fun
will be called at each step. This allows users implementing their own model.
template<typename Data_Type >
void Tree< Data_Type >::prune_postorder |
( |
v_uint & |
seq | ) |
|
|
inline |
Do the tree-traversal using the postorder with a user specific sequence.
Same as prune_postorder
but with a different sequence
- Parameters
-
seq | A new sequence to apply. |
template<typename Data_Type >
void Tree< Data_Type >::prune_preorder |
( |
| ) |
|
|
inline |
template<typename Data_Type >
void Tree< Data_Type >::prune_preorder |
( |
v_uint & |
seq | ) |
|
|
inline |
Do the tree-traversal using the preorder with a user specific sequence.
Same as prune_preorder
but with a different sequence
- Parameters
-
seq | A new sequence to apply. |
template<typename Data_Type = bool>
template<typename Data_Type = bool>
Postorder sequence.
The POSTORDER vector shows the order in which TreeIterator runs through the tree. This is set at the moment during which the tree is created.
The documentation for this class was generated from the following file: