A mistake maybe?

in the code of GRAPH -11 topological sort using bfs , bhaiya forgot to mark the visited nodes

@debyian,
We are working on directed acyclic graph, so we don’t need to mark visited nodes. We mark visited nodes only so as to prevent infinite loop in case a cycle is present, which is not present in a directed acyclic graph.

E.g graph: 1 -> 2 -> 3 -> 1, so we will be stuck in an infinite loop, but no such case in DAG.

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.