visited is the set of search states already explored. A search marks a state when it discovers it, preventing cycles and repeated work while the frontier continues toward a goal. section 2.2
Maze search
In a grid maze, MazeLocation values identify positions. When DFS reaches a location, visited prevents it from following links back into already searched locations and becoming trapped in a loop. Parent pointers still preserve the successful route for reconstruction. section 2.2
