Add k-closest-nodes function.