1 / 9

Lecture 13

Lecture 13. CSE 331 Oct 2, 2009. Announcements. Please turn in your HW 3. Graded HW2, solutions to HW 3, HW 4 at the END of the class. Maybe extra lectures next week on proofs– check the blog!. Connected Component. Connected component (of s ) is the set of all nodes connected to s.

afi
Download Presentation

Lecture 13

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 13 CSE 331 Oct 2, 2009

  2. Announcements Please turn in your HW 3 Graded HW2, solutions to HW 3, HW 4 at the END of the class Maybe extra lectures next week on proofs– check the blog!

  3. Connected Component Connected component (of s) is the set of all nodes connected to s

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

  5. R is the connected component of s Claim 1: All vertices in R are connected to s Start with R = {s} Base Case Induction on number of iterations While exists (u,v) edge v not in R and u in R Add v to R I.H.: u is connected to s Output R

  6. Today’s agenda If w is not in R then w is not connected to s Depth First Search Computing all connected components Run-time analysis of DFS and BFS

  7. A DFS run Every non-tree edge is between a node and its ancestor 1 1 7 2 2 3 8 4 4 5 5 DFS tree 6 6 3 8 7

  8. Connected components are disjoint Either Connected components of s and t are the same or are disjoint Algorithm to compute ALL the connected components? Run BFS on some node s. Then run BFS on t that is not connected to s

  9. Read Sec 3.2

More Related