charde-kaufman
Uploaded by
25 SLIDES
385 VIEWS
250LIKES

Understanding and Implementing Breadth-First Search Animation: A Step-by-Step Guide

DESCRIPTION

This document provides a comprehensive walkthrough of the Breadth-First Search (BFS) algorithm, including its animation implementation. It covers initialization, selecting and marking nodes, handling admissible arcs, and updating the node list as nodes are processed. Key steps include identifying admissibility of arcs, manipulating the node list, and ensuring the accuracy of node predecessors. By following this guide, readers will gain a deep understanding of BFS and its practical animation application, making complex graph traversal understandable and visually engaging.

1 / 25

Download Presentation

Understanding and Implementing Breadth-First Search Animation: A Step-by-Step Guide

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript

Playing audio...

  1. 15.082 and 6.855J Breadth First Search Breadth first search animation

  2. 4 4 2 2 8 8 1 1 5 5 7 7 9 9 3 3 6 6 1 1 next Initialize 1 1 Unmark all nodes in N; Mark node s pred(1) = 0 next := 1order(next) = 1 LIST:= {1} LIST Breadth first search animation

  3. 4 2 8 1 5 7 9 3 6 1 next Select a node i in LIST 1 1 1 In breadth first search, i is the first node in LIST LIST 1 Breadth first search animation

  4. If node i is incident to an admissible arc… 2 4 2 2 8 1 1 1 1 5 7 Mark Node j pred(j) := i Select an admissible arc (i,j) Next := Next + 1 order(j) := next add j to LIST 9 3 6 LIST 1 2 1 2 next Breadth first search animation

  5. If node i is incident to an admissible arc… 2 4 2 2 8 1 1 1 1 5 5 7 3 Mark Node j pred(j) := i Select an admissible arc (i,j) Next := Next + 1 order(j) := next add j to LIST 9 3 6 LIST 1 2 5 2 3 next Breadth first search animation

  6. If node i is incident to an admissible arc… 2 4 2 2 8 1 1 1 1 5 5 7 3 Next := Next + 1 order(j) := next add j to LIST Mark Node j pred(j) := i Select an admissible arc (i,j) 9 3 3 6 4 LIST 1 2 5 3 2 4 3 next Breadth first search animation

  7. If node i is not incident to an admissible arc… 2 4 2 2 8 1 1 1 1 1 5 5 7 3 9 Delete node i from LIST 3 3 6 4 LIST 1 2 5 3 2 4 3 next Breadth first search animation

  8. Select Node i 2 4 2 2 2 8 1 1 1 1 1 5 5 7 3 9 The first node on LIST becomes node i 3 3 6 4 LIST 1 2 5 3 2 3 4 next Breadth first search animation

  9. If node i is incident to an admissible arc… 5 2 4 4 2 2 2 8 1 1 1 5 5 7 3 Select an admissible arc (i,j) Mark Node j pred(j) := i Next := Next + 1 order(j) := next add j to LIST 9 3 3 6 4 LIST 1 2 5 3 4 4 3 2 5 next Breadth first search animation

  10. If node i is not incident to an admissible arc… 5 2 4 4 2 2 2 2 8 1 1 1 5 5 7 3 Delete node i from LIST 9 3 3 6 4 LIST 1 2 5 3 4 3 4 2 5 next Breadth first search animation

  11. Select a node 5 2 4 4 2 2 2 8 1 1 1 5 5 5 7 3 The first node on LIST becomes node i 9 3 3 6 4 LIST 1 2 5 3 4 3 4 2 5 next Breadth first search animation

  12. If node i is incident to an admissible arc… 5 2 4 4 2 2 2 8 1 1 1 5 5 5 7 3 Select an admissible arc (i,j) Next := Next + 1 order(j) := next add j to LIST Mark Node j pred(j) := i 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 3 4 6 2 5 next Breadth first search animation

  13. If node i is not incident to an admissible arc… 5 2 4 4 2 2 2 8 1 1 1 5 5 5 5 7 3 Delete node i from LIST 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 6 2 4 3 5 next Breadth first search animation

  14. Select node 3 5 2 4 4 2 2 2 8 1 1 1 5 5 5 5 7 3 node 3 is not incident to any admissible arcs delete node 3 from LIST 9 3 3 3 3 6 6 4 6 LIST 1 2 5 3 4 6 5 6 4 2 3 next Breadth first search animation

  15. Select a node 5 2 4 4 4 2 2 8 1 1 1 5 5 7 3 i : = 4 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 3 4 2 5 6 next Breadth first search animation

  16. If node i is incident to an admissible arc… 5 2 4 4 4 7 2 2 8 8 1 1 1 5 5 7 3 Mark Node j pred(j) := i Next := Next + 1 order(j) := next add j to LIST Select an admissible arc (i,j) 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 8 3 5 4 7 2 6 next Breadth first search animation

  17. If node i is not incident to an admissible arc… 5 2 4 4 4 4 7 2 2 8 8 1 1 1 5 5 7 3 Delete node i from LIST 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 8 7 3 5 4 2 6 next Breadth first search animation

  18. Select node i 5 2 4 4 7 2 2 8 8 1 1 1 5 5 7 3 i := 6 9 3 3 6 6 6 4 6 LIST 1 2 5 3 4 6 8 7 2 5 4 3 6 next Breadth first search animation

  19. If node i is incident to an admissible arc… 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 Next := Next + 1 order(j) := next add j to LIST Mark Node j pred(j) := i Select an admissible arc (i,j) 9 3 3 6 6 6 4 6 LIST 1 2 5 3 4 6 8 7 7 5 4 8 3 2 6 next Breadth first search animation

  20. If node i is incident to an admissible arc… 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 Next := Next + 1 order(j) := next add j to LIST Select an admissible arc (i,j) Mark Node j pred(j) := i 9 9 3 3 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 6 5 4 9 3 8 2 7 next Breadth first search animation

  21. If node i is not incident to an admissible arc… 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 Delete node i from LIST 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 6 5 4 3 8 2 9 7 next Breadth first search animation

  22. Select node 8 5 2 4 4 7 2 2 8 8 8 8 1 8 1 1 5 5 7 7 3 node 8 is not incident to an admissible arc; delete it from LIST 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 7 5 4 3 8 2 9 6 next Breadth first search animation

  23. Select node 7 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 7 7 3 node 7 is not incident to an admissible arc; delete it from LIST 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 6 7 5 4 3 8 2 9 next Breadth first search animation

  24. Select node 9 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 node 9 is not incident to an admissible arc; delete it from LIST 9 9 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 9 3 6 7 2 5 4 8 next Breadth first search animation

  25. THE END Breadth first search animation

More Related