define neighbours as function