Back to the 2024 paper

Module 3: Graph and Tree Algorithms

20247m

A graph with five nodes is represented using the adjacency list as follows:

A -> B (10) C (3)
B -> C (1) D (5)
C -> B (4) D (8) E (2)
D -> E (7)
E -> D (9)

Answer the following:
(i) Draw the graph for the above adjacency list.
(ii) Write the algorithm for the Breadth-First Traversal (BFS).
(iii) Show the BFS traversal of the graph with the starting node as A.

Similar questions