create compute_neighborhoods method