Presentation is loading. Please wait.

Presentation is loading. Please wait.

Undirected Depth First Search

Similar presentations


Presentation on theme: "Undirected Depth First Search"— Presentation transcript:

1 Undirected Depth First Search
B C G Adjacency Lists A: F C B G B: A C: A D: F E E: G F D F: A E D: G: E A: H: I: I: H: D E F

2 Undirected Depth First Search
B C G D E F newly discovered F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

3 Undirected Depth First Search
A already marked B C G D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

4 Undirected Depth First Search
B C G D E newly discovered E E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

5 Undirected Depth First Search
B C G G newly discovered G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

6 Undirected Depth First Search
visit(G) (G, E) (G, A) E already marked B C G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

7 Undirected Depth First Search
visit(G) (G, E) (G, A) A already marked B C G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

8 Undirected Depth First Search
Finished G visit(G) (G, E) (G, A) B C G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

9 Undirected Depth First Search
F already marked B C G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

10 Undirected Depth First Search
B C G D newly discovered D visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

11 Undirected Depth First Search
F already marked visit(D) (D, F) (D, E) B C G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

12 Undirected Depth First Search
E already marked visit(D) (D, F) (D, E) B C G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

13 Undirected Depth First Search
Finished D visit(D) (D, F) (D, E) B C G visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

14 Undirected Depth First Search
B C G Finished E visit(E) (E, G) (E, F) (E, D) D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

15 Undirected Depth First Search
D already marked B C G D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

16 Undirected Depth First Search
B C G D E Finished F visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

17 Undirected Depth First Search
C newly discovered C B C G D E F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

18 Undirected Depth First Search
A already marked B C G D E visit(C) (C, A) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

19 Undirected Depth First Search
B C G D E Finished C visit(C) (C, A) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

20 Undirected Depth First Search
B newly discovered B B C G D E F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

21 Undirected Depth First Search
A already marked B C G D E visit(B) (B, A) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

22 Undirected Depth First Search
B C G D E Finished B visit(B) (B, A) F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

23 Undirected Depth First Search
G already finished B C G D E F visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

24 Undirected Depth First Search
B C G D E F Finished A visit(A) (A, F) (A, C) (A, B) (A, G) Undiscovered Marked Active Finished Stack

25 Undirected Depth First Search
B C G D E F Undiscovered Marked Active Finished Stack

26 Undirected Depth First Search
I newly discovered I I B C G D E F visit(H) (H, I) Undiscovered Marked Active Finished Stack

27 Undirected Depth First Search
H already marked B C G D E visit(I) (I, H) F visit(H) (H, I) Undiscovered Marked Active Finished Stack

28 Undirected Depth First Search
B C G D E Finished I visit(I) (I, H) F visit(H) (H, I) Undiscovered Marked Active Finished Stack

29 Undirected Depth First Search
B C G D E F FinishedH visit(H) (H, I) Undiscovered Marked Active Finished Stack

30 Undirected Depth First Search
B C G D E F Undiscovered Marked Active Finished Stack


Download ppt "Undirected Depth First Search"

Similar presentations


Ads by Google