A library for working with phylogenetic and population genetic data.
v0.27.0
tree/function/operators.cpp File Reference

Detailed Description

Implementation of Tree operator functions.

Definition in file tree/function/operators.cpp.

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

bool belongs_to (Subtree const &subt, Tree const &tree)
 Return whether the Subtree belongs to the Tree, i.e., whether its link is owned by the Tree. More...
 
bool belongs_to (Tree const &tree, Subtree const &subt)
 Return whether the Subtree belongs to the Tree, i.e., whether its link is owned by the Tree. More...
 
bool belongs_to (Tree const &tree, TreeEdge const &edge)
 Return whether the TreeEdge belongs to the Tree, i.e., whether it is owned by the Tree. More...
 
bool belongs_to (Tree const &tree, TreeLink const &link)
 Return whether the TreeLink belongs to the Tree, i.e., whether it is owned by the Tree. More...
 
bool belongs_to (Tree const &tree, TreeNode const &node)
 Return whether the TreeNode belongs to the Tree, i.e., whether it is owned by the Tree. More...
 
bool belongs_to (TreeEdge const &edge, Tree const &tree)
 Return whether the TreeEdge belongs to the Tree, i.e., whether it is owned by the Tree. More...
 
bool belongs_to (TreeLink const &link, Tree const &tree)
 Return whether the TreeLink belongs to the Tree, i.e., whether it is owned by the Tree. More...
 
bool belongs_to (TreeNode const &node, Tree const &tree)
 Return whether the TreeNode belongs to the Tree, i.e., whether it is owned by the Tree. More...
 
Tree convert (Tree const &source, std::function< std::unique_ptr< BaseNodeData >(BaseNodeData const &node_data)> node_data_converter, std::function< std::unique_ptr< BaseEdgeData >(BaseEdgeData const &edge_data)> edge_data_converter)
 Create a tree with the same topology as the source tree, while converting its data. More...
 
TreeEdge * edge_between (TreeNode &lhs, TreeNode &rhs)
 Return the TreeEdge between two TreeNode&s, if they are neighbours, or nullptr otherwise. More...
 
TreeEdge const * edge_between (TreeNode const &lhs, TreeNode const &rhs)
 Return the TreeEdge between two TreeNode&s, if they are neighbours, or nullptr otherwise. More...
 
bool equal (std::vector< Tree > const &trees, std::function< bool(TreeNode const &, TreeNode const &) > node_comparator, std::function< bool(TreeEdge const &, TreeEdge const &) > edge_comparator)
 Compare all trees for equality given binary comparator functionals for their nodes and edges. More...
 
bool equal (Tree const &lhs, Tree const &rhs, std::function< bool(TreeNode const &, TreeNode const &) > node_comparator, std::function< bool(TreeEdge const &, TreeEdge const &) > edge_comparator)
 Compare two trees for equality given binary comparator functionals for their nodes and edges. More...
 
bool identical_topology (std::vector< Tree > const &trees, bool identical_indices=true)
 Return whether all trees have an identical topology. More...
 
bool identical_topology (Tree const &lhs, Tree const &rhs, bool identical_indices=true)
 Return whether both trees have an identical topology. More...
 
std::ostream & operator<< (std::ostream &out, Tree const &tree)
 
std::ostream & operator<< (std::ostream &out, TreeEdge const &edge)
 
std::ostream & operator<< (std::ostream &out, TreeLink const &link)
 
std::ostream & operator<< (std::ostream &out, TreeNode const &node)
 
std::string print_gist (Tree const &tree, long items)
 
std::string print_info (Tree const &tree)
 
std::string print_info (TreeEdge const &edge)
 
std::string print_info (TreeLink const &link)
 
std::string print_info (TreeNode const &node)
 
bool validate_topology (Tree const &tree)
 Validate that all internal pointers of the Tree elements (TreeLinks, TreeNodes, TreeEdges) to each other are correct and that some other invariants are met. More...