Check if a given path exists in a graph
Regarding the code, I'd have only 2 suggestions:


Use brackets even for single-line ifs. It improves readability and makes the code less error prone.
Try not to shorten member names too much (like iter or it for example). It improves readability.


As for the chosen algorithm and possible alternative I'd suggest Iterative Deepening DFS. It has the best of both Depth-First Search and Breadth-First Search - it's complete, finds the optimal solution, and doesn't use too much space.

Let me know if anything's unclear.