Breadth First Search
1. Consider the following graph:
Vertices, V = [a, b, c, d, e, f]
Edges, E = [[a, b], [a, c], [b, d], [b, e], [c, e], [c, f]]
Where each array within E signifies an edge between the two mentioned vertices.
How many queue-deletion iterations are required for BFS to completely traverse this graph when starting from vertex 'a' and marking each vertex as visited when it is first added to the queue?
Vertices, V = [a, b, c, d, e, f]
Edges, E = [[a, b], [a, c], [b, d], [b, e], [c, e], [c, f]]
Where each array within E signifies an edge between the two mentioned vertices.
How many queue-deletion iterations are required for BFS to completely traverse this graph when starting from vertex 'a' and marking each vertex as visited when it is first added to the queue?
2. When comparing the auxiliary space requirements of BFS and DFS on a graph, under what condition can BFS require more space than DFS? Here, BFS space is associated with the maximum frontier size and DFS space with the maximum depth of the traversal.
3. What is the main reason BFS can be used to find shortest paths in an unweighted graph?
4. Which statement correctly describes the role of the queue in BFS?
5. Consider a graph with vertices and edges represented by adjacency lists. What is the time complexity of BFS when all reachable vertices and their adjacency lists are processed?
6. A BFS implementation marks a vertex as visited only when it is removed from the queue instead of when it is first discovered. What problem can arise in a graph where multiple vertices have edges to the same unvisited vertex?
7. Consider an unweighted graph in which BFS assigns distance to the source vertex. If vertex receives distance , what does this distance represent?
8. In a BFS traversal of a connected graph, a vertex is placed in the queue when it is first discovered. Which statement about that vertex is correct?
9. Consider an unweighted graph where two different paths from source to vertex contain 3 and 5 edges respectively. If BFS reaches through the path containing 3 edges first, what distance should BFS assign to ?