An algorithm for semi-supervised learning in image retrieval