Added visitNeighbors algorithm