Single solution
When you are looking for a single solution during graph traversal, you need to add each element to a visited set to avoid loops, you can use a visited set to keep track of the nodes. This is common with tree or dags
Multiple solution
There are graph traversal problems that requires exploring all possible paths in a recursion, such as:
- All Paths: To find all paths between two nodes
- Combinatorial Problems: Like finding all subsets of nodes that satisfy a condition
- State-based Problems: Where the “state” includes both the current node and the path taken to reach it