A library for working with phylogenetic and population genetic data.
v0.27.0
function/tree_set.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_FUNCTION_TREE_SET_H_
2 #define GENESIS_TREE_FUNCTION_TREE_SET_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2020 Lucas Czech and HITS gGmbH
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
34 #include <functional>
35 #include <string>
36 
37 namespace genesis {
38 namespace tree {
39 
40 // =================================================================================================
41 // Forward Declarations
42 // =================================================================================================
43 
44 class Tree;
45 class TreeNode;
46 class TreeEdge;
47 class TreeSet;
48 
49 // =================================================================================================
50 // Tree Set Functions
51 // =================================================================================================
52 
57 Tree * find_tree ( TreeSet & tree_set, std::string const& name);
58 
63 Tree const* find_tree ( TreeSet const& tree_set, std::string const& name);
64 
65 // =================================================================================================
66 // Comparators
67 // =================================================================================================
68 
74 bool equal(
75  TreeSet const& tree_set,
76  std::function<bool( TreeNode const&, TreeNode const& )> node_comparator,
77  std::function<bool( TreeEdge const&, TreeEdge const& )> edge_comparator
78 );
79 
80 // /**
81 // * @brief Compare whether all Tree%s in a TreeSet are equal using their default comparision
82 // * operators for nodes and edges.
83 // */
84 // bool all_equal( TreeSet const& tree_set );
85 
89 bool identical_topology( TreeSet const& tree_set );
90 
91 } // namespace tree
92 } // namespace genesis
93 
94 #endif // include guard
genesis::tree::find_tree
Tree * find_tree(TreeSet &tree_set, std::string const &name)
Get the first Tree in a TreeSet that is stored with a given name, or nullptr if not found.
Definition: tree_set.cpp:48
genesis::placement::tree_set
tree::TreeSet tree_set(SampleSet const &sample_set)
Return a TreeSet containing all the trees of the SampleSet.
Definition: sample_set.cpp:156
genesis::tree::identical_topology
bool identical_topology(Tree const &lhs, Tree const &rhs, bool identical_indices)
Return whether both trees have an identical topology.
Definition: tree/function/operators.cpp:170
genesis::tree::equal
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.
Definition: tree/function/operators.cpp:81
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42