|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_COMMON_TREE_FUNCTIONS_H_
2 #define GENESIS_TREE_COMMON_TREE_FUNCTIONS_H_
64 bool leaves_only =
false
76 bool leaves_only =
false
88 std::string
const& name,
89 bool throw_on_failure =
false,
90 bool replace_underscores =
false
100 std::string
const& name,
101 bool throw_on_failure =
false,
102 bool replace_underscores =
false
115 bool throw_on_failure =
false,
116 bool replace_underscores =
false
127 bool throw_on_failure =
false,
128 bool replace_underscores =
false
138 double length( Tree
const& tree );
144 double height( Tree
const& tree );
150 double diameter( Tree
const& tree );
196 #endif // include guard
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 br...
std::vector< std::string > node_names(Tree const &tree, bool leaves_only)
Returns a list of all TreeNode names of a Tree.
tree::TreeSet tree_set(SampleSet const &sample_set)
Return a TreeSet containing all the trees of the SampleSet.
double length(Tree const &tree)
Get the length of the tree, i.e., the sum of all branch lengths.
double diameter(Tree const &tree)
Get the diameter of the tree, i.e., the longest distance between any two nodes, measured using the br...
std::vector< double > branch_lengths(Tree const &tree)
Get a vector of all branch lengths of a Tree, index by the edge index.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::vector< TreeNode const * > find_nodes(Tree const &tree, std::vector< std::string > const &node_names, bool throw_on_failure, bool replace_underscores)
Find TreeNodes in a Tree, given their name.
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 T...
TreeNode const * find_node(Tree const &tree, const std::string &name, bool throw_on_failure, bool replace_underscores)
Finds a Node, given its name.
void scale_all_branch_lengths(Tree &tree, double factor)
Scale all branch lengths of a Tree by a given factor.
void set_all_branch_lengths(Tree &tree, double length)
Set all branch lengths of a Tree to a given value.