What is the difference between dft and bft when they both give us the nodes(vertices) Name.
Are there any special cases where one is preffered over the other
Difference between DFT and BFT
Hi @ubaidshaikh9999,
The main difference is the order in which they return the vertices. Both of them have various advantages over other depending on the case.The major difference between BFT and DFT is that BFT proceeds level by level while DFT follows first a path form the starting to the ending node (vertex), then another path from the start to end, and so on until all nodes are visited.So for some case such as finding a cycle dfs might be preferred but surely any of the methods can be used to do a particular task . The key point is order of traversal .
Hope this helps
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.