Practice Problem: Check if there is a directed path from node to node . Input: nodes, edges, and a query . Output: "YES" if can reach , "NO" otherwise. Hint: Run SCC detection. If and are in the same SCC, answer is "YES" (mutual reachability).
If they are in different SCCs, check if there is a path from scc[a] to scc[b] in the condensation DAG using BFS or DFS. This is faster than running BFS from every time if you have multiple queries.