is this code fr both undirected and directed graph ? if tere is a another unconncted graph what will happen?
Graphs 08- Depth First Search code doubt
@ritwikbiswas
Unconnected components will not be covered in a single DFS call. We make seperate calls to them using a loop. You will learn this method in further videos as to how it is done.
As for undirected and directed , the code is designed to work for undirected graphs but will work for directed as well. However , directed graphs will bring a new set of problems with them since the connectivity is directional and makes traversals complicated.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.