|NU Year||Set: 3.(a) Marks: 5 Year: 2010|
The major difference between BFS and DFS is that BFS proceeds level by level while DFS 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. Furthermore, BFS uses the queue for storing the nodes whereas DFS uses the stack for traversal of the nodes.
BFS and DFS are the traversing methods used in searching a graph. Graph traversal is the process of visiting all the nodes of the graph.