A Computational Theory and Semi-Supervised Algorithm for Clustering