Lecture 12 CSE 331 Sep 30, 2009. Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2...

7
Lecture 12 CSE 331 Sep 30, 2009
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    1

Transcript of Lecture 12 CSE 331 Sep 30, 2009. Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2...

Page 1: 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,

Lecture 12

CSE 331Sep 30, 2009

Page 2: 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,

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

Page 3: 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,

Breath First Search (BFS)

Is s connected to t?

Build layers of vertices connected to s

L0 = {s}

Assume L0,..,Lj have been constructed

Lj+1 set of vertices not chosen yet but are connected to Lj

Stop when new layer is empty

Lj : all nodes at distance j from sLj : all nodes at

distance j from s

Page 4: 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,

BFS TreeBFS naturally defines a tree rooted at s

Lj forms the jth “level” in the tree

u in Lj+1 is child of v in Lj from which it was “discovered”

11

22 33

44 55

66

77

88

11

22 33

L0

L1

44 55 77 88L2

66L3

Add non-tree edgesAdd non-

tree edges

Page 5: 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,

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

Page 6: 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,

Today’s agenda

Every edge is between consecutive layers

Depth First Search

Page 7: 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,

A DFS run

11

22 33

44 55

66

77

88

11

22

44

55

66 33

88

77