1 / 12

Lecture 12

Lecture 12. CSE 331 Sep 25, 2017. Mini Project group due TODAY!. Register for CSE 50!. https://engineering.buffalo.edu/computer-science-engineering/news-events/cse50.html. Use the “Current Student & Faculty Registration” option.

brooklyn
Download Presentation

Lecture 12

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. Lecture 12 CSE 331 Sep 25, 2017

  2. Mini Project group due TODAY!

  3. Register for CSE 50! https://engineering.buffalo.edu/computer-science-engineering/news-events/cse50.html Use the “Current Student & Faculty Registration” option We will have class on Friday and HW 3 is still due 11am on Friday

  4. Connectivity Problem Input: Graph G = (V,E) and s in V Output: All t connected to s in G

  5. Breadth First Search (BFS) Build layers of vertices connected to 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

  6. 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 9 2 3 L1 2 3 8 0 4 7 8 L2 5 5 4 6 6 L3

  7. Today’s agenda Every edge in is between consecutive layers Computing Connected component

  8. Computing Connected Component Explore(s) Start with R = {s} While exists (u,v) edge v not in R and u in R Add v to R Output R* = R

  9. Questions?

  10. BFS all

  11. Depth First Search (DFS) http://xkcd.com/761/

  12. DFS(u) Mark u as explored and add u to R For each edge (u,v) If v is not explored then DFS(v)

More Related