lecture16

# lecture16 - Graph Theory Breadth First Search Graph Theory...

This preview shows pages 1–3. Sign up to view the full content.

Graph Theory Breadth First Search IE170: Algorithms in Systems Engineering: Lecture 16 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University February 28, 2007 Jeff Linderoth IE170:Lecture 16 Graph Theory Breadth First Search Taking Stock Last Time The Wonderful World of Graph Theory Breadth First Search This Time Finish Breadth-First Search Depth-First Search Jeff Linderoth IE170:Lecture 16 Graph Theory Breadth First Search Graph Search Algorithms There are two “workhorse” algorithms for searching graphs that form the basis for many more complicated algorithms. Breadth-First Search (BFS): Search “broadly” Depth-First Search (DFS): Search “deeply” BFS: Last Time DFS: Today Jeff Linderoth IE170:Lecture 16 Graph Theory Breadth First Search Recall—BFS BFS Input : Graph G = ( V, E ) , source node s V Output : d ( v ) , distance (smallest # of edges) from s to v v V Output : π ( v ) , predecessor of v on the shortest path from s to v Oh no! DP again δ ( s, v ) : shortest path from s to v Lemma: If ( u, v ) E , then δ ( s, v ) δ ( s, u ) + 1 Jeff Linderoth IE170:Lecture 16

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Graph Theory Breadth First Search BFS BFS ( V, E, s ) 1 for each u in V \ { s } 2 do d ( u ) ← ∞ 3 π ( u ) nil 4 d [ s ] 0 5 Q ← ∅ 6 add ( Q, s ) 7 while Q = 8 do u poll ( Q ) 9 for each v in Adj [ u ] 10 do if d [ v ] = 11 then d [ v ] d [ u ] + 1 12 π [ v ] = u 13 add ( Q, v ) Jeff Linderoth IE170:Lecture 16 Graph Theory Breadth First Search Analysis How many times is each vertex added? Answer: Once. So | V | for add operation How many times is adjaceny list of vertex v scanned?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern