A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tree/default/distances.cpp File Reference

Detailed Description

Implementation of Default Tree distance methods.

Definition in file tree/default/distances.cpp.

#include "genesis/tree/default/distances.hpp"
#include "genesis/tree/tree.hpp"
#include "genesis/tree/iterator/levelorder.hpp"
#include "genesis/tree/function/lca_lookup.hpp"
#include "genesis/utils/math/matrix/operators.hpp"
#include <algorithm>
#include <assert.h>
#include <stdexcept>

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

std::vector< std::pair
< TreeNode const *, double > > 
closest_leaf_distance_vector (Tree const &tree)
 Return a vector containing the closest leaf node for each node, using the branch_length as distance measure. More...
 
std::vector< std::pair
< TreeNode const *, double > > 
closest_leaf_distance_vector (Tree const &tree, utils::Matrix< double > const &node_distances)
 
double deepest_distance (Tree const &tree)
 Return the longest distance from any point in the tree (on the edges) to any leaf. More...
 
utils::Matrix< double > edge_branch_length_distance_matrix (Tree const &tree)
 
std::vector< double > edge_branch_length_distance_vector (Tree const &tree, TreeEdge const *edge)
 
std::vector< std::pair
< TreeNode const *, double > > 
furthest_leaf_distance_vector (Tree const &tree)
 Opposite of closest_leaf_distance_vector(). More...
 
std::vector< std::pair
< TreeNode const *, double > > 
furthest_leaf_distance_vector (Tree const &tree, utils::Matrix< double > const &node_distances)
 
template<class Comparator >
std::vector< std::pair
< TreeNode const *, double > > 
leaf_distance_vector (Tree const &tree, utils::Matrix< double > const &node_distances, Comparator comp)
 Local helper function to calculate either closest_leaf_distance_vector() or furthest_leaf_distance_vector(). More...
 
utils::Matrix< double > node_branch_length_distance_matrix (Tree const &tree)
 Return a distance matrix containing pairwise distances between all Nodes, using the branch_length of the Edges as distance measurement. More...
 
std::vector< double > node_branch_length_distance_vector (Tree const &tree, TreeNode const *node=nullptr)
 Return a vector containing the distance of all nodes with respect to the given start node, where distance is measured in the sum of branch lengths between the nodes. More...