1 / 25

Lecture 11

Lecture 11. CSE 331 Sep 20, 2019. Mini Project group due week from Monday!. Please respect the TAs. HW 3 is out!. Solutions to HW 2. Handed out at the end of the lecture. Graded HW 1. Should be released by tonight. Formally define everything.

hei
Download Presentation

Lecture 11

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 11 CSE 331 Sep 20, 2019

  2. Mini Project group due week from Monday!

  3. Please respect the TAs

  4. HW 3 is out!

  5. Solutions to HW 2 Handed out at the end of the lecture

  6. Graded HW 1 Should be released by tonight

  7. Formally define everything http://imgs.xkcd.com/comics/geeks_and_nerds.png

  8. Distance between u and v Length of the shortest length path between u and v 1 Distance between RM and BO?

  9. Tree Connected undirected graph with no cycles

  10. Rooted Tree

  11. A rooted tree AC’s child=SG Pick any vertex as root SG’s parent=AC Let the rest of the tree hang under “gravity”

  12. Every n vertex tree has n-1 edges

  13. Every n vertex tree has n-1 edges Let G be an undirected graph on n nodes Then ANY two of the following implies the third: T is connected T has no cycles T has n-1 edges

  14. Rest of Today’s agenda Algorithms for checking connectivity

  15. Checking by inspection

  16. What about large graphs? s t Are s and t connected?

  17. Brute-force algorithm? List all possible vertex sequences between s and t nn such sequences Check if any is a path between s and t

  18. Algorithm motivation all

  19. Breadth First Search (BFS)

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

  21. 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 by an edge to Lj Stop when new layer is empty

  22. 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

  23. Today’s agenda Computing Connected component

  24. 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

  25. Questions?

More Related