Initial clustering algorithm