add neighbors function