Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unweighted Shortest Path Neil Tang 3/11/2010

Similar presentations


Presentation on theme: "Unweighted Shortest Path Neil Tang 3/11/2010"— Presentation transcript:

1 Unweighted Shortest Path Neil Tang 3/11/2010
CS223 Advanced Data Structures and Algorithms

2 CS223 Advanced Data Structures and Algorithms
Class Overview The unweighted shortest path problem Breadth First Search (BFS) The algorithms Time complexity CS223 Advanced Data Structures and Algorithms

3 Unweighted Shortest Path Problem
The unweighted shortest path problem: Given an unweighted graph G and a source vertex s, find a path from s to every other vertex in G with a minimum number of edges. CS223 Advanced Data Structures and Algorithms

4 CS223 Advanced Data Structures and Algorithms
BFS CS223 Advanced Data Structures and Algorithms

5 CS223 Advanced Data Structures and Algorithms
An Algorithm Time complexity: O(|V|2) CS223 Advanced Data Structures and Algorithms

6 CS223 Advanced Data Structures and Algorithms
Time Complexity A bad case More efficient implementation: Use a queue Time complexity of a queue-based implementation: O(|V|+|E|) CS223 Advanced Data Structures and Algorithms


Download ppt "Unweighted Shortest Path Neil Tang 3/11/2010"

Similar presentations


Ads by Google