1 / 2

Breadth First Search (BFS)

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

Télécharger la présentation

Breadth First Search (BFS)

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