Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— 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} While exists (u,v) edge v not in R and u in R Add v to R Output R Induction on number of iterations Base Case I.H.: u is connected to s

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 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 1 1 2 2 4 4 5 5 6 6 3 3 8 8 7 7 Every non- tree edge is between a node and its ancestor DFS tree

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


Download ppt "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."

Similar presentations


Ads by Google