Lecture 22

# Introduction to Algorithms, Second Edition

• Notes
• davidvictor
• 3

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

The University of Texas at Austin Breadth-first search Department of Computer Sciences Professor Vijaya Ramachandran Lecture 22 CS357: ALGORITHMS, Spring 2006 1 Breadth-first search and unweighted shortest paths We consider here the single-source shortest paths problem on an unweighted graph G = ( V, E ) (directed or undirected). Here, we are given as input a source vertex s V , and we need to find a path of shortest length from s to every other vertex in V . By definition, if there is no path from s to a vertex u , then the length of a shortest path from s to u is . The well-known algorithm to solve this problem is called breadth-first search . The length of a shortest path from s to u is called the distance from s to u , and is denoted by δ ( s, u ). We now study the breadth-first search algorithm that computes shortest-path dis- tances from source s . With a small modification, the algorithm also computes a shortest path tree rooted at s that gives the edges on a shortest path to each vertex; this is in the textbook,

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

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