Download presentation
Presentation is loading. Please wait.
Published byJunior Barnett Modified over 9 years ago
2
1 Undirected Breadth First Search F A BCG DE H Source: http://www.cs.princeton.edu/~wayne/cs423/demos.html
3
2 Undirected Breadth First Search F A BCG DE H Queue: A get 0 distance from A visit(A) Undiscovered Discovered Finished Top of queue
4
3 Undirected Breadth First Search F A BCG DE H Queue: A 0 F 1 F discovered Undiscovered Discovered Finished Top of queue
5
4 Undirected Breadth First Search F A BCG DE H Queue: A F 0 1 B 1 B discovered Undiscovered Discovered Finished Top of queue
6
5 Undirected Breadth First Search F A BCG DE H Queue: A F B 0 1 1 C 1 C discovered Undiscovered Discovered Finished Top of queue
7
6 Undirected Breadth First Search F A BCG DE H Queue: A F B C 0 1 1 1 G 1 G discovered Undiscovered Discovered Finished Top of queue
8
7 Undirected Breadth First Search F A BCG DE H Queue: A F B C G get 0 1 1 1 1 A finished Undiscovered Discovered Finished Top of queue
9
8 Undirected Breadth First Search F A BCG DE H Queue: A F B C G 0 1 1 1 1 A already visited Undiscovered Discovered Finished Top of queue
10
9 Undirected Breadth First Search F A BCG DE H Queue: A F B C G 0 1 1 1 1 D 2 D discovered Undiscovered Discovered Finished Top of queue
11
10 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D 0 1 1 1 1 2 E 2 E discovered Undiscovered Discovered Finished Top of queue
12
11 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 F finished Undiscovered Discovered Finished Top of queue
13
12 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 Undiscovered Discovered Finished Top of queue get
14
13 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 A already visited Undiscovered Discovered Finished Top of queue
15
14 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 B finished Undiscovered Discovered Finished Top of queue get
16
15 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 A already visited Undiscovered Discovered Finished Top of queue
17
16 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E get 0 1 1 1 1 2 2 C finished Undiscovered Discovered Finished Top of queue
18
17 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 A already visited Undiscovered Discovered Finished Top of queue
19
18 Undirected Breadth First Search F A BCG DE H Undiscovered Fringe Finished Queue: A F B C G D E Active 0 1 1 1 1 2 2 E already visited
20
19 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E get 0 1 1 1 1 2 2 G finished Undiscovered Discovered Finished Top of queue
21
20 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 E already visited Undiscovered Discovered Finished Top of queue
22
21 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 F already visited Undiscovered Discovered Finished Top of queue
23
22 Undirected Breadth First Search F A BCG DE H Undiscovered Fringe Finished Queue: A F B C G D E Active get 0 1 1 1 1 2 2 D finished
24
23 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 D already visited Undiscovered Discovered Finished Top of queue
25
24 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 F already visited Undiscovered Discovered Finished Top of queue
26
25 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 G already visited Undiscovered Discovered Finished Top of queue
27
26 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E 0 1 1 1 1 2 2 H 3 H discovered Undiscovered Discovered Finished Top of queue
28
27 Undirected Breadth First Search F A BCG DE Queue: A F B C G D E H get 0 1 1 1 1 2 2 H 3 E finished Undiscovered Discovered Finished Top of queue
29
28 Undirected Breadth First Search F A BCG DE H Undiscovered Fringe Finished Queue: A F B C G D E H Active 0 1 1 1 1 2 2 3 E already visited
30
29 Undirected Breadth First Search F A BCG DE H Queue: A F B C G D E H STOP 0 1 1 1 1 2 2 3 H finished Undiscovered Discovered Finished Top of queue
31
30 Undirected Breadth First Search F A BCG DE H 0 1 1 1 1 2 2 3 distance from A
32
31 Directed Breadth First Search s 2 5 4 7 8 369
33
32 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s
34
33 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 Top of queue 3 1 1
35
34 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 Top of queue 5 1 1 1
36
35 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 Top of queue 1 1 1
37
36 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 Top of queue 4 1 1 1 2
38
37 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 Top of queue 1 1 1 2 5 already discovered: don't enqueue
39
38 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 Top of queue 1 1 1 2
40
39 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 Top of queue 1 1 1 2
41
40 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 Top of queue 1 1 1 2 6 2
42
41 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 Top of queue 1 1 1 2 2
43
42 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 Top of queue 1 1 1 2 2
44
43 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 Top of queue 1 1 1 2 2
45
44 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 Top of queue 1 1 1 2 2
46
45 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 Top of queue 1 1 1 2 2 8 3
47
46 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 Top of queue 1 1 1 2 2 3
48
47 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 Top of queue 1 1 1 2 2 3 7 3
49
48 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 Top of queue 1 1 1 2 2 3 9 3 3
50
49 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
51
50 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 9 Top of queue 1 1 1 2 2 3 3 3
52
51 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
53
52 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
54
53 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
55
54 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
56
55 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
57
56 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
58
57 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
59
58 Directed Breadth First Search s 2 5 4 7 8 369 0 Undiscovered Discovered Finished Queue: s 2 3 5 4 6 8 7 9 Top of queue 1 1 1 2 2 3 3 3
60
59 Directed Breadth First Search s 2 5 4 7 8 369 0 BFS Tree 1 1 1 2 2 3 3 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.