From: westcott Date: Wed, 23 Dec 2009 19:16:36 +0000 (+0000) Subject: added average and nearest neighbor methods to hcluster X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=64ead0dc966e9a9768a24c8f55518db83ed2e82f added average and nearest neighbor methods to hcluster --- diff --git a/hcluster.cpp b/hcluster.cpp index 4e8c994..72af7c8 100644 --- a/hcluster.cpp +++ b/hcluster.cpp @@ -280,7 +280,8 @@ void HCluster::update(int row, int col, float distance){ bool cluster = false; if (method == "nearest") { cluster = true; } - else if (method == "average") { cout << "still working on this... " << endl; //got to figure this out + else if (method == "average") { + if (linkValue == (ceil(((clusterArray[smallRow].numSeq * clusterArray[smallCol].numSeq)) / (float) 2.0))) { cluster = true; } }else{ //assume furthest if (linkValue == (clusterArray[smallRow].numSeq * clusterArray[smallCol].numSeq)) { cluster = true; } }