bpp-phyl3  3.0.0
PhyloStatistics.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_PHYLOSTATISTICS_H
6 #define BPP_PHYL_PHYLOSTATISTICS_H
7 
8 #include <Bpp/Clonable.h>
9 
10 #include "Tree/Tree.h"
11 
12 // From the STL:
13 #include <vector>
14 
15 namespace bpp
16 {
26  public virtual Clonable
27 {
28 private:
31  std::vector<double> branchLengths_;
32  std::vector<double> nodeHeights_;
33  std::vector<size_t> nodeDepths_;
34  std::vector<size_t> nodeNumberOfSons_;
35  std::vector<int> nodeIds_;
36 
37 public:
41  {}
42  virtual ~PhyloStatistics() {}
43 
44  PhyloStatistics* clone() const { return new PhyloStatistics(*this); }
45 
51  void setTree(const Tree& tree);
52 
53  size_t getNumberOfLeaves() const { return numberOfLeaves_; }
54  size_t getNumberOfAncestors() const { return numberOfAncestors_; }
55  const std::vector<double>& getBranchLengths() const { return branchLengths_; }
56  const std::vector<double>& getNodeHeights() const { return nodeHeights_; }
57  const std::vector<size_t>& getNodeDepths() const { return nodeDepths_; }
58  const std::vector<size_t>& getNodeNumberOfSons() const { return nodeNumberOfSons_; }
59  const std::vector<int>& getNodeIds() const { return nodeIds_; }
60 
61 private:
62  void computeForSubtree_(const Node* node, double& height, size_t& depth);
63 };
64 } // end of namespace bpp.
65 #endif // BPP_PHYL_PHYLOSTATISTICS_H
The phylogenetic node class.
Definition: Node.h:59
Compute several quantities on a tree simulateously, optimizing the recursions on the tree.
size_t getNumberOfAncestors() const
const std::vector< double > & getNodeHeights() const
const std::vector< size_t > & getNodeDepths() const
void computeForSubtree_(const Node *node, double &height, size_t &depth)
const std::vector< size_t > & getNodeNumberOfSons() const
std::vector< int > nodeIds_
std::vector< double > nodeHeights_
size_t getNumberOfLeaves() const
const std::vector< int > & getNodeIds() const
void setTree(const Tree &tree)
Compute statistics for a given input tree.
PhyloStatistics * clone() const
std::vector< size_t > nodeDepths_
std::vector< size_t > nodeNumberOfSons_
std::vector< double > branchLengths_
const std::vector< double > & getBranchLengths() const
Interface for phylogenetic tree objects.
Definition: Tree.h:115
Defines the basic types of data flow nodes.