[cluster] First version of hierarchical clustering