Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 12 CSE 331 Sep 30, 2009. Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2 solutions at the end of the lecture Mid term: Oct 16,

Similar presentations


Presentation on theme: "Lecture 12 CSE 331 Sep 30, 2009. Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2 solutions at the end of the lecture Mid term: Oct 16,"— Presentation transcript:

1 Lecture 12 CSE 331 Sep 30, 2009

2 Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2 solutions at the end of the lecture Mid term: Oct 16, in class

3 Breath First Search (BFS) Is s connected to t? Build layers of vertices connected to 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 L j : all nodes at distance j from s

4 BFS Tree BFS naturally defines a tree rooted at s L j forms the jth “level” in the tree u in L j+1 is child of v in L j from which it was “discovered” 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 1 1 2 2 3 3 L0L0 L1L1 4 4 5 5 7 7 8 8 L2L2 6 6 L3L3 Add non- tree edges

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

6 Today’s agenda Every edge is between consecutive layers Depth First Search

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


Download ppt "Lecture 12 CSE 331 Sep 30, 2009. Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2 solutions at the end of the lecture Mid term: Oct 16,"

Similar presentations


Ads by Google