Graph Theory37 sections · 1633 units
Open in Course

Common SCC Mistakes

(Debugging tips)

Common mistake in Kosaraju: forgetting to reset the visited array between the two DFS passes. If you do not reset, the second pass will not visit any nodes. Common mistake in Tarjan: updating low[v] with disc[u] even when uu is not on the current stack.

Only update low[v] if uu is still on the stack (use an on_stackon\_stack array). Debug tip: Trace your algorithm by hand on a small graph (44-55 nodes). Print discdisc, lowlow, and stack contents at each step. Compare with expected output.