1 / 2

Building Layers of Connected Vertices using Breadth First Search

Breadth First Search (BFS) is connected to a start node (s) by building layers of vertices connected to s. Create layers of vertices at different distances from s. The BFS tree naturally forms a rooted tree at s, with non-tree edges forming levels.

Download Presentation

Building Layers of Connected Vertices using Breadth First Search

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


  1. Breadth First Search (BFS) Is s connected to t? Build layers of vertices connected to s Lj: all nodes at distance j from s L0= {s} Assume L0,..,Ljhave been constructed Lj+1set of vertices not chosen yet but are connected to Lj Stop when new layer is empty

  2. BFS Tree BFS naturally defines a tree rooted at s Add non-tree edges Lj forms the jth “level” in the tree u in Lj+1is child of v in Lj from which it was “discovered” L0 1 7 1 2 3 L1 2 3 8 4 7 8 L2 5 5 4 6 6 L3

More Related