7#include "../Tree/Tree.h"
18double BioNJ::computeDistancesFromPair(
const vector<size_t>& pair,
const vector<double>& branchLengths,
size_t pos)
51 if (
variance_(bestPair[0], bestPair[1]) == 0)
58 if (
id != bestPair[0] &&
id != bestPair[1])
73 if (
id != bestPair[0] &&
id != bestPair[1])
89 matrix_( bestPair[0],
id) =
matrix_(
id, bestPair[0]) = newDist[id];
virtual Node * getLeafNode(int id, const std::string &name)
Get a leaf node.
virtual Node * getParentNode(int id, Node *son1, Node *son2)
Get an inner node.
std::map< size_t, Node * > currentNodes_
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.
void computeTree()
Compute the tree corresponding to the distance matrix.
const std::string & getName(std::size_t i) const
std::vector< size_t > getBestPair()
Get the best pair of nodes to agglomerate.
void finalStep(int idRoot)
Method called when there ar eonly three remaining node to agglomerate, and creates the root node of t...
std::vector< double > computeBranchLengthsForPair(const std::vector< size_t > &pair)
Compute the branch lengths for two nodes to agglomerate.
The phylogenetic node class.
virtual void setDistanceToFather(double distance)
Set or update the distance toward the father node.
Defines the basic types of data flow nodes.