A library for working with phylogenetic and population genetic data.
v0.27.0
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-2018 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 <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 // Node Distance Measures
52 // =================================================================================================
53 
62 utils::Matrix<size_t> node_path_length_matrix( Tree const& tree );
63 
71 std::vector<size_t> node_path_length_vector(
72  Tree const& tree,
73  TreeNode const& node
74 );
75 
83 std::vector<size_t> node_path_length_vector(
84  Tree const& tree
85 );
86 
87 // =================================================================================================
88 // Edge Distance Measures
89 // =================================================================================================
90 
91 utils::Matrix<size_t> edge_path_length_matrix(
92  Tree const& tree
93 );
94 
95 std::vector<size_t> edge_path_length_vector(
96  Tree const& tree,
97  TreeEdge const& edge
98 );
99 
100 // =================================================================================================
101 // Complex Distance Methods
102 // =================================================================================================
103 
120 std::vector< std::pair< TreeNode const*, size_t >> closest_leaf_depth_vector(
121  Tree const& tree
122 );
123 
124 } // namespace tree
125 } // namespace genesis
126 
127 #endif // include guard
genesis::tree::edge_path_length_vector
std::vector< size_t > edge_path_length_vector(Tree const &tree, TreeEdge const &edge)
Definition: tree/function/distances.cpp:202
genesis::tree::edge_path_length_matrix
utils::Matrix< size_t > edge_path_length_matrix(Tree const &tree)
Definition: tree/function/distances.cpp:144
matrix.hpp
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
genesis::tree::node_path_length_matrix
utils::Matrix< size_t > node_path_length_matrix(Tree const &tree)
Return a matrix containing the pairwise depth of all nodes of the tree.
Definition: tree/function/distances.cpp:56
genesis::tree::node_path_length_vector
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.
Definition: tree/function/distances.cpp:98
genesis::tree::closest_leaf_depth_vector
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 ...
Definition: tree/function/distances.cpp:251