Shortest Paths
Compute weighted shortest paths with the algorithm that fits the graph's edge weights, size and queries.
4 objectives 6 steps about 120 min
Check what you know
The lessons are coming later. The knowledge check is ready now.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Implement Dijkstra's algorithm with heapq and lazy deletion, reconstruct the path, and explain why it fails with negative edges.
- Implement Bellman-Ford, detect negative cycles, and relate its V-1 relaxation rounds to path lengths.
- Select among BFS, 0-1 BFS, Dijkstra, Bellman-Ford, DAG relaxation and Floyd-Warshall given edge weights, graph size and query pattern.
- Speed up point-to-point search with A* and an admissible heuristic, and measure the reduction in expanded nodes.
Lesson plan
6 steps, about 120 min · 0 of 5 lessons available so far
- Relaxation: The Shared Core Concept · 15 min · coming later
- Dijkstra with a Heap Worked example · 25 min · coming later
- Negative Weights and Bellman-Ford Worked example · 20 min · coming later
- Matching the Algorithm to the Graph Concept · 20 min · coming later
- Lab: Goal-Directed Search with A* Lab · 25 min · coming later
- Check: Weighted Path Problems Knowledge check · 8 questions
Practise it
On a weighted road graph, implement Dijkstra, Bellman-Ford and A*, cross-check 200 random queries against Floyd-Warshall on a 100-node subgraph, and report runtime and expanded nodes for each algorithm. Add an admissible but inconsistent heuristic case and either reopen improved nodes or document why a consistent heuristic is required; test unreachable goals and reachable negative cycles against the oracle.
References
Hard prerequisites
Unlocks
Nothing depends on this skill yet.
On these roadmaps
Progress and evidence for this skill are shared across all of them.