Pass the number of neighbours as parameter.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>