Download presentation
Presentation is loading. Please wait.
Published byDerrick Powers Modified over 5 years ago
1
Dijkstra’s Shortest Path Algorithm Neil Tang 03/25/2008
CS223 Advanced Data Structures and Algorithms
2
CS223 Advanced Data Structures and Algorithms
Class Overview The shortest path problem Applications Dijkstra’s algorithm Implementation and time complexities CS223 Advanced Data Structures and Algorithms
3
CS223 Advanced Data Structures and Algorithms
Shortest Path Problem Weighted path length (cost): The sum of the weights of all links on the path. The single-source shortest path problem: Given a weighted graph G and a source vertex s, find the shortest (minimum cost) path from s to every other vertex in G. CS223 Advanced Data Structures and Algorithms
4
CS223 Advanced Data Structures and Algorithms
An Example CS223 Advanced Data Structures and Algorithms
5
CS223 Advanced Data Structures and Algorithms
Another Example CS223 Advanced Data Structures and Algorithms
6
CS223 Advanced Data Structures and Algorithms
Applications Digital map Computer network Travel planning CS223 Advanced Data Structures and Algorithms
7
CS223 Advanced Data Structures and Algorithms
Dijkstra’s Algorithm CS223 Advanced Data Structures and Algorithms
8
CS223 Advanced Data Structures and Algorithms
Dijkstra’s Algorithm CS223 Advanced Data Structures and Algorithms
9
CS223 Advanced Data Structures and Algorithms
Dijkstra’s Algorithm CS223 Advanced Data Structures and Algorithms
10
CS223 Advanced Data Structures and Algorithms
Dijkstra’s Algorithm CS223 Advanced Data Structures and Algorithms
11
CS223 Advanced Data Structures and Algorithms
Dijkstra’s Algorithm CS223 Advanced Data Structures and Algorithms
12
CS223 Advanced Data Structures and Algorithms
Dijkstra’s Algorithm CS223 Advanced Data Structures and Algorithms
13
CS223 Advanced Data Structures and Algorithms
Dijkstra’s Algorithm CS223 Advanced Data Structures and Algorithms
14
Implementation and Time Complexities
Trivial: O(|V|2 + |E|) = O(|V|2) Heap: deleteMin |V| times + decreaseKey |E| times O(|V|log|V| + |E|log|V|) = O (|E|log|V|) Fibonacci heap: O(|E| + |V|log|V|) CS223 Advanced Data Structures and Algorithms
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.