converted nearestNeighbor to use findNearestNodeTo