what is DFS and BFS traversal starting at node B.
Given graph G = (V, E) where V = {A, B, C, D, E, F, G} and E = {(A, D), (B, A), (B, C), (C, D), (C, F), (C, G), (E, C), (E, D), (F, A), (F, E), (G, B)}
@alakhprivate, BFS is a vertex based technique,In BFS, one vertex is selected at a time when it is visited and marked then its adjacent are visited and stored in the queue.
so BFS output would be B A C D F G E
DFS stands for Depth First Search is a edge based technique. It uses the Stack data structure, performs two stages, first visited vertices are pushed into stack and second if there is no vertices then visited vertices are popped.
so DFS output would be B A D C F E G
In case of any doubt feel free to ask
Mark your doubt as resolved if you got the answer