what is wrong in my code.Why is not displaying the correct output,it is showing 0s instead of component .
correct it and explain the error.
Don’ t suggest some other code.
Error in my code
Reply as soon as possible , it has been more than 4 hours.
Reply as soon as possible
I already made visited false before running dfscolor . So please check it thoroughly before sending anything and check if output if coming correct or not after modifying the code
@D19APPPP0016 no you are not making the visited array false for every element. You just taking a copy of map pair and making that copy false, it would not effect your actual visited map. For making changes to visited take x by reference.
for(auto& x :visited)
If this resolves your doubt mark it as resolved.