update cluster algorithm