Last updated 3 years ago
Was this helpful?
Note that if a graph is acyclic, we don't need to keep a set of visited nodes to prevent going into a loop.
Example: