Help n this question

what is stack[nbr ]==true doing please explain

Hey @adarshsingh2k
To detect a back edge, we keep track of vertices currently in recursion stack of function for DFS traversal. If a vertex is reached that is already in the recursion stack, then there is a cycle in the graph. The edge that connects current vertex to the vertex in the recursion stack is a back edge. Hence we use Stack[] array to keep track of vertices in the recursion stack.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.