Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 12 CSE 331 Sep 28, 2012.

Similar presentations


Presentation on theme: "Lecture 12 CSE 331 Sep 28, 2012."— Presentation transcript:

1 Lecture 12 CSE 331 Sep 28, 2012

2 HW 3 due today I will not take any HW after 1:15pm
Q1, Q2 and Q3 in different piles I will not take any HW after 1:15pm

3 Interview Pro Current engineers Potential leg-up on hiring
Monday (10/1) - 6-8:30 - Salvadore Lounge (2nd Floor Davis Hall) - Resumes/fancy clothing optional Current engineers Potential leg-up on hiring Learn industry expectations Free Food/Swag Sign up here

4 Other HW related stuff HW 4 has been posted online: see blog/piazza
Solutions to HW 3 at the END of the lecture Graded HW 2: pickup from TAs next week

5 Tree Connected undirected graph with no cycles

6 Rooted Tree

7 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”

8 HW 3 due today I will not take any HW after 1:15pm
Q1, Q2 and Q3 in different piles I will not take any HW after 1:15pm

9 Rest of Today’s agenda Prove n vertex tree has n-1 edges
Algorithms for checking connectivity

10 Checking by inspection

11 What about large graphs?
Are s and t connected?

12 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

13 Algorithm motivation all

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

15 Questions?

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

17 Exercise for you Prove that Lj has all nodes at distance j from s

18 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+1 is child of v in Lj from which it was “discovered” 1 7 1 L0 2 3 L1 2 3 8 4 5 4 5 7 8 L2 6 6 L3


Download ppt "Lecture 12 CSE 331 Sep 28, 2012."

Similar presentations


Ads by Google