r/computerscience • • Apr 21 '25
Help Doubt in Dsa
Guys, while traversing a directed graph using BFS or DFS, some nodes may not be reachable. What should we do in that case? Is it okay to leave ?
28
Upvotes


View all comments
Show parent comment
1
u/Doctor_Disaster Apr 21 '25
I agree with this. It can be concluded the graph is not strongly connected due to no source allowing for complete traversal in a single go.
In order to visit every single node at least once, you'd need to perform at least 2 traversals from separate nodes, like A and E.
It's been a while since I took DSA...