A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tree/function/distances.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_FUNCTION_DISTANCES_H_
2 #define GENESIS_TREE_FUNCTION_DISTANCES_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2017 Lucas Czech
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 <vector>
35 
37 
38 namespace genesis {
39 namespace tree {
40 
41 // =================================================================================================
42 // Foward Declarations
43 // =================================================================================================
44 
45 class Tree;
46 class TreeNode;
47 class TreeEdge;
48 class TreeLink;
49 
50 // =================================================================================================
51 // Distance Measures
52 // =================================================================================================
53 
54 utils::Matrix<size_t> node_path_length_matrix( Tree const& tree );
55 
56 std::vector<size_t> node_path_length_vector(
57  Tree const& tree,
58  TreeNode const& node
59 );
60 
61 std::vector<size_t> node_path_length_vector(
62  Tree const& tree
63 );
64 
65 utils::Matrix<size_t> edge_path_length_matrix(
66  Tree const& tree
67 );
68 
69 std::vector<size_t> edge_path_length_vector(
70  Tree const& tree,
71  TreeEdge const& edge
72 );
73 
74 // =================================================================================================
75 // Complex Distance Methods
76 // =================================================================================================
77 
78 std::vector< std::pair< TreeNode const*, size_t >> closest_leaf_depth_vector(
79  Tree const& tree
80 );
81 
82 } // namespace tree
83 } // namespace genesis
84 
85 #endif // include guard
std::vector< size_t > node_path_length_vector(Tree const &tree, TreeNode const &node)
Return a vector containing the depth of all nodes with respect to the given start node...
std::vector< size_t > edge_path_length_vector(Tree const &tree, TreeEdge const &edge)
utils::Matrix< size_t > node_path_length_matrix(Tree const &tree)
Return a matrix containing the pairwise depth of all nodes of the tree.
utils::Matrix< size_t > edge_path_length_matrix(Tree const &tree)
std::vector< std::pair< TreeNode const *, size_t > > closest_leaf_depth_vector(const Tree &tree)
Returns a vector containing the closest leaf node for each node, measured in number of edges between ...