Lecture overview
Learning objectives
After this lecture you should be able to:
- 1.Formulate the single-source and all-pairs shortest-path problems.
- 2.Run Dijkstra’s algorithm and explain why it fails with negative edge weights.
- 3.Use Bellman–Ford to handle negative edges and detect negative cycles.
- 4.Select among BFS, Dijkstra, Bellman–Ford, A*, Floyd–Warshall and Johnson for a given setting.
Prerequisites
Key Concepts
Dijkstra · Bellman-Ford · A* Algorithm · Floyd-Warshall · BFS · Johnson's Algorithm · Shortest Path · Weighted Graphs · Negative Cycles
1Introduction
1.1Introduction
The shortest path problem seeks the minimum-cost path between points in a graph, where cost can represent distance, time, or any numerical metric. This problem underpins critical applications in navigation, computer networks, robotics, logistics, social network analysis, and many other fields.
Problem Definition
Given a weighted graph G = (V, E) and vertices s (source) and t (target), find the path from s to t with minimum total weight.
Types of Shortest Path Problems
- Single-Source Shortest Path: From one vertex to all others
- Single-Destination Shortest Path: From all vertices to one target
- Single-Pair Shortest Path: Between two specific vertices
- All-Pairs Shortest Path: Between every pair of vertices
Section 1 of 7