Skip to content

Commit

Permalink
update cSize after distMatrix is updated for correct average calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev-Lan committed Aug 15, 2023
1 parent 837d5f1 commit af90148
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hcluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export function hcluster() {
depth: 1 + Math.max(c1Cluster.depth, c2Cluster.depth),
};
clusters[c1] = newCluster;
cSize[c1] += cSize[c2];

// overwrite row c1 with respect to the linkage type
for (let j = 0; j < n; j++) {
Expand All @@ -130,6 +129,7 @@ export function hcluster() {
break;
}
}
cSize[c1] += cSize[c2];

for (let i = 0; i < n; i++) {
distMatrix[i][c2] = distMatrix[c2][i] = Infinity;
Expand Down

0 comments on commit af90148

Please sign in to comment.