5 #ifndef BPP_PHYL_DISTANCE_ABSTRACTAGGLOMERATIVEDISTANCEMETHOD_H
6 #define BPP_PHYL_DISTANCE_ABSTRACTAGGLOMERATIVEDISTANCEMETHOD_H
9 #include "../Tree/Node.h"
10 #include "../Tree/TreeTemplate.h"
40 bool rootTree =
false) :
50 bool rootTree =
false) :
88 return tree_ !=
nullptr;
96 throw NullPointerException(
"AbstractAgglomerativeDistanceMethod::tree(). No tree was computed.");
157 virtual double computeDistancesFromPair(
const std::vector<size_t>& pair,
const std::vector<double>& branchLengths,
size_t pos) = 0;
Partial implementation of the AgglomerativeDistanceMethod interface.
virtual Node * getLeafNode(int id, const std::string &name)
Get a leaf node.
AbstractAgglomerativeDistanceMethod(const AbstractAgglomerativeDistanceMethod &a)
virtual ~AbstractAgglomerativeDistanceMethod()
AbstractAgglomerativeDistanceMethod & operator=(const AbstractAgglomerativeDistanceMethod &a)
virtual double computeDistancesFromPair(const std::vector< size_t > &pair, const std::vector< double > &branchLengths, size_t pos)=0
Actualizes the distance matrix according to a given pair and the corresponding branch lengths.
virtual std::vector< double > computeBranchLengthsForPair(const std::vector< size_t > &pair)=0
Compute the branch lengths for two nodes to agglomerate.
virtual void setDistanceMatrix(const DistanceMatrix &matrix) override
Set the distance matrix to use.
bool isVerbose() const override
virtual Node * getParentNode(int id, Node *son1, Node *son2)
Get an inner node.
void setVerbose(bool yn) override
virtual std::vector< size_t > getBestPair()=0
Get the best pair of nodes to agglomerate.
AbstractAgglomerativeDistanceMethod(const DistanceMatrix &matrix, bool verbose=true, bool rootTree=false)
std::unique_ptr< Tree > tree_
bool hasTree() const override
virtual void finalStep(int idRoot)=0
Method called when there ar eonly three remaining node to agglomerate, and creates the root node of t...
AbstractAgglomerativeDistanceMethod(bool verbose=true, bool rootTree=false)
std::map< size_t, Node * > currentNodes_
const Tree & tree() const override
void computeTree() override
Compute the tree corresponding to the distance matrix.
Interface for agglomerative distance methods.
The phylogenetic node class.
The phylogenetic tree class.
Interface for phylogenetic tree objects.
Defines the basic types of data flow nodes.