Download presentation

Presentation is loading. Please wait.

Published byMaud Fields Modified over 2 years ago

1
Breadth-First Search David Johnson

2
Today Look at one version of Breadth-first search on a grid Develop Matlab version of BFS

3
Wavefront planner Use BFS on a grid Label cells with values –Zero means unchecked –1 is obstacle –Set start cell to 2 Expand from start Add +1 to neighbors of current wavefront Use gradient descent to search from goal to start

4
Representations: A Grid Distance is reduced to discrete steps –For simplicity, we’ll assume distance is uniform Direction is now limited from one adjacent cell to another

5
Representations: Connectivity 8-Point Connectivity –(chessboard metric) 4-Point Connectivity –(Manhattan metric)

6
The Wavefront Planner: Setup

7
The Wavefront in Action (Part 1) Starting with the goal, set all adjacent cells with “0” to the current cell + 1 –4-Point Connectivity or 8-Point Connectivity? –Your Choice. We’ll use 8-Point Connectivity in our example

8
The Wavefront in Action (Part 2) Now repeat with the modified cells –This will be repeated until goal is reached 0’s will only remain when regions are unreachable

9
The Wavefront in Action (Part 3) Repeat again...

10
The Wavefront in Action (Part 4) And again...

11
The Wavefront in Action (Part 5) And again until...

12
The Wavefront in Action (Done) You’re done

13
The Wavefront To find the shortest path simply always move toward a cell with a lower number –The numbers generated by the Wavefront planner are roughly proportional to their distance from the goal Two possible shortest paths shown

14
Developing the Breadth-First Search Algorithm Store the list of graph vertices under consideration (the wavefront). –Store indices rather than the whole vertex Look for successors of the wavefront Put the successors back on the wavefront –Where should they go? 1 st gen2 nd gen3 rd gen

15
Queue A queue is a datastructure where you can –Add elements to the back –Take an element off the front First in the queue is first out –FIFO

16
Queue Matlab can easily make a queue –Pop element from front element = wavefront(1) wavefront = wavefront(2:end) –Add to end wavefront = [wavefront newelement]

17
Matlab Develop BFS in Matlab

Similar presentations

OK

Basic Search Procedure 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the.

Basic Search Procedure 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on conceptual art history Ppt on value education for students Ppt on solar system for class 3 Ppt on bluetooth communication standard Ppt on step down transformer Ppt on non ferrous minerals and vitamins Ppt on data handling for class 8 cbse Ppt on waves tides and ocean currents indian Ppt on bolivia water war Ppt on solar system for class 5