What is the output of the BFS traversal of the graph below?

2021

What is the output of the BFS traversal of the graph below?

image.png

  1. A.

    A F D B C E

  2. B.

    C B A F D

  3. C.

    A B D C F

  4. D.

    F D C B A

  5. E.

    Question not attempted

Attempted by 316 students.

Show answer & explanation

Correct answer: C

Breadth-First Search (BFS) starts from the source node and explores all nodes at the present depth level before moving to nodes at the next depth level.

Step 1: Begin at node A. Visit A.

Step 2: Visit all neighbors of A: B and D. The current order is A, B, D.

Step 3: Visit neighbors of B: C. Visit neighbors of D: E and F. The order becomes A, B, D, C, E, F.

Final BFS traversal: A, B, D, C, E, F.

हिन्दी उत्तर:

ब्रॉडथ-फर्स्ट सर्च (BFS) स्रोत नोड से शुरू होता है और वर्तमान गहराई स्तर पर सभी नोड्स को अगले गहराई स्तर पर जाने से पहले खोजता है।

चरण 1: A से शुरू करें। A का दौरा करें।

चरण 2: A के सभी पड़ोसियों को देखें: B और D। वर्तमान क्रम A, B, D है।

चरण 3: B के पड़ोसियों को देखें: C। D के पड़ोसियों को देखें: E और F। क्रम A, B, D, C, E, F हो जाता है।

अंतिम BFS ट्रैवर्सल: A, B, D, C, E, F।

Explore the full course: Up Lt Grade Assistant Teacher 2025