Download presentation
Presentation is loading. Please wait.
Published byΝεοπτόλημος Βούλγαρης Modified over 6 years ago
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.