|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
49 bool compare_node_names,
50 bool compare_branch_lengths
52 auto node_comparator = [&] (
56 if( ! compare_node_names ) {
61 auto r_ptr =
dynamic_cast< CommonNodeData const*
>( node_r.data_ptr() );
62 if( l_ptr ==
nullptr || r_ptr ==
nullptr ) {
69 return l_ptr->
name == r_ptr->name;
72 auto edge_comparator = [&] (
76 if( ! compare_branch_lengths ) {
81 auto r_ptr =
dynamic_cast< CommonEdgeData const*
>( edge_r.data_ptr() );
82 if( l_ptr ==
nullptr || r_ptr ==
nullptr ) {
92 return tree::equal( lhs, rhs, node_comparator, edge_comparator );
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.
bool almost_equal_relative(double lhs, double rhs, double max_rel_diff=std::numeric_limits< double >::epsilon())
Check whether two doubles are almost equal, using a relative epsilon to compare them.
bool equal_common_trees(Tree const &lhs, Tree const &rhs, bool compare_node_names, bool compare_branch_lengths)
Compare two CommonTrees, that is, check whether they have identical topology, node names,...
Base class for storing data on Edges of a Tree.
CommonTree convert_to_common_tree(Tree const &source_tree)
Convert a Tree to a CommonTree with CommonNodeData and CommonEdgeData.
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.
virtual std::unique_ptr< BaseNodeData > clone() const override
Polymorphically copy an instance of this class. Use instead of copy constructor.
Class for representing phylogenetic trees.
Provides easy and fast logging functionality.
std::string name
Name of the node.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Base class for storing data on Nodes of a Tree.
BaseEdgeData * data_ptr()
Return a pointer to the data.
virtual std::unique_ptr< BaseEdgeData > clone() const override
Polymorphically copy an instance of this class. Use instead of copy constructor.
Common class containing the commonly needed data for tree edges.
Common class containing the commonly needed data for tree nodes.
BaseNodeData * data_ptr()
Return a pointer to the data.