A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tree/function/functions.cpp File Reference
#include "genesis/tree/function/functions.hpp"
#include "genesis/tree/function/distances.hpp"
#include "genesis/tree/function/operators.hpp"
#include "genesis/tree/iterator/eulertour.hpp"
#include "genesis/tree/tree.hpp"
#include "genesis/utils/math/matrix/operators.hpp"
#include <algorithm>
#include <cassert>
#include <functional>
#include <unordered_set>
#include <vector>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::tree
 

Functions

utils::Matrix< signed char > edge_sides (Tree const &tree)
 Create a Matrix that indiciaces the relative position of the Edges of a Tree, i.e., whether they are on the root side or non-root side. More...
 
size_t inner_edge_count (Tree const &tree)
 Return the number of Edges of a Tree that do not lead to a leaf Node. More...
 
size_t inner_node_count (Tree const &tree)
 Count the number of inner Nodes. More...
 
bool is_bifurcating (Tree const &tree)
 Return whether the Tree is bifurcating. More...
 
size_t leaf_edge_count (Tree const &tree)
 Return the number of Edges of a Tree that lead to a leaf Node. More...
 
size_t leaf_node_count (Tree const &tree)
 Count the number of leaf Nodes of a Tree. More...
 
TreeNode const & lowest_common_ancestor (TreeNode const &node_a, TreeNode const &node_b)
 Return the lowest common ancestor of two TreeNodes. More...
 
TreeNode & lowest_common_ancestor (TreeNode &node_a, TreeNode &node_b)
 Return the lowest common ancestor of two TreeNodes. More...
 
utils::Matrix< size_t > lowest_common_ancestors (Tree const &tree)
 Return the lowest common ancestor of each pair of TreeNodes for a given tree, in form of a Matrix of their indices. More...
 
size_t max_rank (Tree const &tree)
 Return the highest rank of the Nodes of a Tree. More...
 
utils::Matrix< signed char > node_root_direction_matrix (Tree const &tree)
 Calculate a Matrix that indicates the nodes on the root side of a given node. More...
 
std::vector< TreeLink const * > path_to_root (TreeNode const &node)
 Helper function that finds all TreeLinks between a given TreeNode and the root of the Tree. More...
 
size_t subtree_max_path_height (Tree const &tree, TreeLink const &link)
 Calculate the height of a subtree, that is, the maximum path length to a leaf of that subtree, measured in edges between the link and the leaf. More...
 
std::vector< size_t > subtree_max_path_heights (Tree const &tree, TreeNode const &node)
 
std::vector< size_t > subtree_max_path_heights (Tree const &tree)
 
size_t subtree_size (Tree const &tree, TreeLink const &link)
 Return the size of the subtree defined by the given TreeLink, measured in number of nodes. More...
 
std::vector< size_t > subtree_sizes (Tree const &tree, TreeNode const &node)
 Calculate the sizes of all subtrees as seen from the given TreeNode. More...
 
std::vector< size_t > subtree_sizes (Tree const &tree)
 Calculate the sizes of all subtrees as seen from the root of the tree. More...