Introduction to Algorithms, Second Edition

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

View Full Document Right Arrow Icon
The University of Texas at Austin Breadth-frst search Department of Computer Sciences Professor Vijaya Ramachandran Lecture 22 CS357: ALGORITHMS, Spring 2006 1 Breadth-frst 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 Fnd a path of shortest length from s to every other vertex in V . By deFnition, 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-frst 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-Frst search algorithm that computes shortest-path dis- tances from source s . With a small modiFcation, 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, where this computation occurs in the lines that compute π values.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Lecture 22 - The University of Texas at Austin Department...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online