1 #ifndef WEIGHTEDLINKAGE_H
2 #define WEIGHTEDLINKAGE_H
7 #include "rabundvector.hpp"
8 #include "sparsematrix.hpp"
10 /* This class implements the WPGMA, weighted average neighbor clustering algorithm */
12 /***********************************************************************/
14 WeightedLinkage::WeightedLinkage(RAbundVector* rav, ListVector* lv, SparseMatrix* dm, float c, string s) :
15 Cluster(rav, lv, dm, c, s)
22 /***********************************************************************/
23 //This function returns the tag of the method.
24 string WeightedLinkage::getTag() {
29 /***********************************************************************/
30 //This function updates the distance based on the average linkage method.
31 bool WeightedLinkage::updateDistance(MatData& colCell, MatData& rowCell) {
33 if ((saveRow != smallRow) || (saveCol != smallCol)) {
34 // rowBin = rabund->get(smallRow);
35 // colBin = rabund->get(smallCol);
36 // totalBin = rowBin + colBin;
41 colCell->dist = (colCell->dist + rowCell->dist) / 2.0;
46 m->errorOut(e, "WeightedLinkage", "updateDistance");
51 /***********************************************************************/
54 /***********************************************************************/