measure cluster distances