Presentation is loading. Please wait.

Presentation is loading. Please wait.

Breadth First Search Queue:Dequeued Paths: Start: C Find: E Use a BFS to find the path from C to E that passes through the minimum number of nodes. Show.

Similar presentations


Presentation on theme: "Breadth First Search Queue:Dequeued Paths: Start: C Find: E Use a BFS to find the path from C to E that passes through the minimum number of nodes. Show."— Presentation transcript:

1 Breadth First Search Queue:Dequeued Paths: Start: C Find: E Use a BFS to find the path from C to E that passes through the minimum number of nodes. Show your queue and dequeued paths to the right.

2 Breadth First Search Queue: C Dequeued Paths: Start: C Find: E Step: Enqueue start node.

3 Breadth First Search Queue: C Dequeued Paths: C Start: C Find: E Step: Dequeue next path.

4 Breadth First Search Queue: C A,C F,C Dequeued Paths: C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path in a specific order (alphabetical unless otherwise stated).

5 Breadth First Search Queue: C A,C F,C Dequeued Paths: C A,C Start: C Find: E Step: Dequeue next path.

6 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C Dequeued Paths: C A,C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path.

7 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C Dequeued Paths: C A,C F,C Start: C Find: E Step: Dequeue next path.

8 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C Dequeued Paths: C A,C F,C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path.

9 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C Dequeued Paths: C A,C F,C B,A,C Start: C Find: E Step: Dequeue next path.

10 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C Dequeued Paths: C A,C F,C B,A,C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path.

11 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C Dequeued Paths: C A,C F,C B,A,C F,A,C Start: C Find: E Step: Dequeue next path.

12 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C Dequeued Paths: C A,C F,C B,A,C F,A,C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path.

13 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C Dequeued Paths: C A,C F,C B,A,C F,A,C J,A,C Start: C Find: E Step: Dequeue next path.

14 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C B,J,A,C F,J,A,C G,J,A,C Dequeued Paths: C A,C F,C B,A,C F,A,C J,A,C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path.

15 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C B,J,A,C F,J,A,C G,J,A,C Dequeued Paths: C A,C F,C B,A,C F,A,C J,A,C A,F,C Start: C Find: E Step: Dequeue next path.

16 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C B,J,A,C F,J,A,C G,J,A,C B,A,F,C J,A,F,C Dequeued Paths: C A,C F,C B,A,C F,A,C J,A,C A,F,C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path.

17 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C B,J,A,C F,J,A,C G,J,A,C B,A,F,C J,A,F,C Dequeued Paths: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C Start: C Find: E Step: Dequeue next path.

18 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C B,J,A,C F,J,A,C G,J,A,C B,A,F,C J,A,F,C D,G,F,C E,G,F,C Dequeued Paths: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C Start: C Find: E Step: Enqueue paths to all adjacent nodes not already on your path.

19 Breadth First Search Queue: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C J,F,C J,B,A,C G,F,A,C J,F,A,C B,J,A,C F,J,A,C G,J,A,C B,A,F,C J,A,F,C D,G,F,C E,G,F,C Dequeued Paths: C A,C F,C B,A,C F,A,C J,A,C A,F,C G,F,C Start: C Find: E Step: With BFS, you can stop when you enqueue a path to the destination. Answer: C, F, G, E


Download ppt "Breadth First Search Queue:Dequeued Paths: Start: C Find: E Use a BFS to find the path from C to E that passes through the minimum number of nodes. Show."

Similar presentations


Ads by Google