I saw this from an answer to another question
IVlad says that the stack will contain the cycle. But while searching through a graph, wouldn't the nodes that make up the cycle have been popped off in the process?
Maybe he meant in a visited nodes stack? But even then, the visited stack does not cleanly contain the cycle. What I mean is that although the cycle is there, it could have other visited nodes sandwiched between the cycle no?