Which of the following is a possible result of depth first traversal of the given graph(consider 1 to be source element)?

Nguyên Lê

New member
Which of the following is a possible result of depth first traversal of the given graph(consider 1 to be source element)?
A. 1 2 3 4 5
B. 1 2 3 1 4 5
C. 1 4 5 3 2
D. 1 4 5 1 2 3
 
Answer: A
Explanation: As 1 is the source element so it will be considered first. Then we start exploring the vertices which are connected to 1. So there will be two possible results-1 2 3 4 5 and 1 4 5 2 3.
 

Tìm kiếm

Back
Top