Think about the difference:
In directed graphs, you track visiting vs visited. What about undirected?
If you visit A, then B, then see A again, is that always a cycle?
How do you avoid counting the edge You came from? Next unit explains the undirected cycle pattern.
In undirected graphs, going from A to B and back to A is not a cycle. You need to find a path back to a previously visited node that does not use the same edge you arrived on. Track the parent node to distinguish real back edges from the trivial parent edge.