add compute_neighbor_distance method and refactor similarity criteria