tree/common_tree/functions.cpp File Reference

Implementation of Common Tree functions.

Definition in file tree/common_tree/functions.cpp.

`#include "genesis/tree/common_tree/functions.hpp"`

`#include "genesis/tree/common_tree/distances.hpp"`

`#include "genesis/tree/common_tree/tree.hpp"`

`#include "genesis/tree/function/functions.hpp"`

`#include "genesis/tree/function/operators.hpp"`

`#include "genesis/tree/function/tree_set.hpp"`

`#include "genesis/tree/iterator/preorder.hpp"`

`#include "genesis/tree/tree_set.hpp"`

`#include "genesis/utils/text/string.hpp"`

`#include <algorithm>`

`#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 | |

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... | |