ac5918d51bed4db6f5ac837e6660b322123bbd7c angie Tue Apr 26 16:36:45 2011 -0700 Added new lib module hacTree (Hierarchical Agglomerative Clustering),which takes an slList of items and a couple user-defined functions, and returns a binary tree of clusters, with the leaf nodes containing the original input items. The user-defined functions do the interesting parts: computing distance between two items and/or clusters, and merging two items and/or clusters into a new cluster. This is motivated by work on Feature #3711 (vcfTabix: center-weighted haplotype sorting for display of phased genotypes), but I'm hoping it might have other uses. diff --git src/inc/common.h src/inc/common.h index f07edc7..7578095 100644 --- src/inc/common.h +++ src/inc/common.h @@ -338,31 +338,31 @@ /* Reverse the order of the double array. */ void reverseStrings(char **a, int length); /* Reverse the order of the char* array. */ void swapBytes(char *a, char *b, int length); /* Swap buffers a and b. */ /* Some things to manage simple lists - structures that begin * with a pointer to the next element in the list. */ struct slList { struct slList *next; }; -int slCount(void *list); +int slCount(const void *list); /* Return # of elements in list. */ void *slElementFromIx(void *list, int ix); /* Return the ix'th element in list. Returns NULL * if no such element. */ int slIxFromElement(void *list, void *el); /* Return index of el in list. Returns -1 if not on list. */ INLINE void slAddHead(void *listPt, void *node) /* Add new node to start of list. * Usage: * slAddHead(&list, node); * where list and nodes are both pointers to structure * that begin with a next pointer.