Lecture 18 CSE 331 Oct 11, 2010
Mid term Next Monday in class
Mid term entry Has been posted on the blog Don’t read too much into the content of the sample mid-term
On Friday, Oct 15 hours-a-thon Atri: 2:00-3:30 (Bell 123) Jeff: 3:30-5:00 (Commons 9) Alex: 5:00-6:30 (Bell 224)
Feedback forms Am still going through them Images are more confusing then exact definitions Lectures are vague (not precise/well planned)
Graph representations Adjacency matrix Adjacency List (u,v) in E? O(1)O(n) [ O(n v ) ] All neighbors of u? O(n)O(n u ) Space?O(n 2 )O(m+n) Better for sparse graphs and traversals
2 # edges = sum of # neighbors 2m = Σ u in V n u Give 2 pennies to each edge u v Rest of the graph n u =4 n v =3 Total # of pennies = 2m Each edges gives one penny to its end points # of pennies u receives = n u
Questions?
Today’s agenda Run-time analysis of BFS
Breadth First Search (BFS) 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