[Solved] C++ – DFS code error


The problem is that you haven’t coded DFS-VISIT step 4 correctly

Step 4 says for each v ∈ G.Adj[u] but your code says for(int i=0; i<G; i++). Those aren’t the same thing at all. You should only visit the adjacent vertexes.

In fact if you look at your code you never use adj at all. That can’t be right.

solved C++ – DFS code error