e17f555375caa88ec04c1bd824cb776fddd1ea54 kent Sun Aug 24 20:40:53 2014 -0700 Moving an alternative hacTree implementation that minimizes the merge steps to the library. diff --git src/inc/hacTree.h src/inc/hacTree.h index 97006fc..9e8fb44 100644 --- src/inc/hacTree.h +++ src/inc/hacTree.h @@ -67,16 +67,23 @@ struct hacTree *parent; // Cluster that contains this cluster, NULL for root node struct hacTree *left; // Left child, NULL for leaf node struct hacTree *right; // Right child, NULL for leaf node double childDistance; // Result of distance function on left and right kids struct slList *itemOrCluster; // If leaf node, one of the items passed in; // otherwise, result of merging left and right kids' itemOrClusters }; struct hacTree *hacTreeFromItems(const struct slList *itemList, struct lm *localMem, hacDistanceFunction *distF, hacMergeFunction *mergeF, hacCmpFunction *cmpF, void *extraData); /* Using distF, mergeF, optionally cmpF and binary tree operations, * perform a hierarchical agglomerative (bottom-up) clustering of * items. To free the resulting tree, lmCleanup(&localMem). */ +struct hacTree *hacTreeForCostlyMerges(struct slList *itemList, struct lm *localMem, + hacDistanceFunction *distF, hacMergeFunction *mergeF, + void *extraData); +/* Construct hacTree similar to hacTreeForItems, but using a method that will minimize the + * number of calls to the distance and merge functions, assuming they are expensive. + * Do a lmCleanup(&localMem) to free the returned tree. */ + #endif//def HACTREE_H