Graph visit problem solver implementation