A library for working with phylogenetic and population genetic data.
v0.32.0
tree/common_tree/functions.hpp File Reference

Detailed Description

CommonTree functions.

Definition in file tree/common_tree/functions.hpp.

#include <set>
#include <string>
#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

Tree average_branch_length_tree (std::vector< Tree > const &tset)
 Return a Tree where the branch lengths are the average of the Trees in the given vector of Trees or TreeSet, given that they all have the same topology. More...
 
std::vector< double > branch_lengths (Tree const &tree)
 Get a vector of all branch lengths of a Tree, index by the edge index. More...
 
double diameter (Tree const &tree)
 Get the diameter of the tree, i.e., the longest distance between any two nodes, measured using the branch_length. More...
 
TreeNode * find_node (Tree &tree, std::string const &name, bool throw_on_failure=false, bool replace_underscores=false)
 Finds a Node, given its name. If not found, nullptr is returned. More...
 
TreeNode const * find_node (Tree const &tree, std::string const &name, bool throw_on_failure=false, bool replace_underscores=false)
 Finds a Node, given its name. More...
 
std::vector< TreeNode * > find_nodes (Tree &tree, std::vector< std::string > const &node_names, bool throw_on_failure=false, bool replace_underscores=false)
 Find TreeNodes in a Tree, given their name. More...
 
std::vector< TreeNode const * > find_nodes (Tree const &tree, std::vector< std::string > const &node_names, bool throw_on_failure=false, bool replace_underscores=false)
 Find TreeNodes in a Tree, given their name. More...
 
double height (Tree const &tree)
 Get the height of the tree, i.e., the longest distance from the root to a leaf, measured using the branch_length. More...
 
double length (Tree const &tree)
 Get the length of the tree, i.e., the sum of all branch lengths. More...
 
std::vector< std::string > node_names (std::vector< Tree > const &tree_set, bool leaves_only=false)
 Returns a set of all TreeNode names of a vector of Trees or a TreeSet. More...
 
std::vector< std::string > node_names (Tree const &tree, bool leaves_only=false)
 Returns a list of all TreeNode names of a Tree. More...
 
void scale_all_branch_lengths (Tree &tree, double factor=1.0)
 Scale all branch lengths of a Tree by a given factor. More...
 
void set_all_branch_lengths (Tree &tree, double length=1.0)
 Set all branch lengths of a Tree to a given value. More...