hierarchial single-linkage clustering algorithm