5 #ifndef BPP_PHYL_DISTANCE_NEIGHBORJOINING_H
6 #define BPP_PHYL_DISTANCE_NEIGHBORJOINING_H
34 NeighborJoining(
bool rooted =
false,
bool positiveLengths =
false,
bool verbose =
true) :
62 std::string
getName()
const {
return "NJ"; }
75 double computeDistancesFromPair(
const std::vector<size_t>& pair,
const std::vector<double>& branchLengths,
size_t pos);
Partial implementation of the AgglomerativeDistanceMethod interface.
virtual void setDistanceMatrix(const DistanceMatrix &matrix) override
Set the distance matrix to use.
void computeTree() override
Compute the tree corresponding to the distance matrix.
The neighbor joining distance method.
NeighborJoining(const DistanceMatrix &matrix, bool rooted=false, bool positiveLengths=false, bool verbose=true)
Create a new NeighborJoining object instance and compute a tree from a distance matrix.
double computeDistancesFromPair(const std::vector< size_t > &pair, const std::vector< double > &branchLengths, size_t pos)
Actualizes the distance matrix according to a given pair and the corresponding branch lengths.
virtual void setDistanceMatrix(const DistanceMatrix &matrix)
Set the distance matrix to use.
virtual ~NeighborJoining()
std::vector< double > sumDist_
std::vector< size_t > getBestPair()
Get the best pair of nodes to agglomerate.
std::string getName() const
NeighborJoining(bool rooted=false, bool positiveLengths=false, bool verbose=true)
Create a new NeighborJoining object instance, without performing any computation.
void finalStep(int idRoot)
Method called when there ar eonly three remaining node to agglomerate, and creates the root node of t...
NeighborJoining * clone() const
virtual void outputPositiveLengths(bool yn)
std::vector< double > computeBranchLengthsForPair(const std::vector< size_t > &pair)
Compute the branch lengths for two nodes to agglomerate.
Defines the basic types of data flow nodes.