Save this video free

Shortest Paths

Kent Quanrud · 1:16:23 · Watch on YouTube

Part of Purdue University Fundamental Algorithms (Fall 2026). See all 20 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Kent Quanrud develops shortest-path algorithms from first principles: breadth-first search (BFS) finds minimum-hop paths in O(m+n), while Dijkstra’s algorithm handles positive edge lengths by repeatedly settling the vertex with the smallest tentative distance. He derives Dijkstra’s correctness and runtime, including the O(m+n log n) bound with a Fibonacci heap, then shows how to reduce an even-edge-count shortest-walk problem to ordinary shortest paths using a two-layer graph with only 2n vertices and 2m edges.

Key takeaways

Chapters

0:00 Shortest Paths Begin with Minimum-Hop Routes
4:28 Weighted Distance, Infinite Values, and the Triangle Inequality
5:08 BFS Finds Minimum-Hop Distances in Layers
11:05 Proving BFS Correct with Induction on Distance
18:33 Positive Edge Lengths Replace Hop Counts
20:55 Why Subdividing Weighted Edges Can Be Too Slow
25:40 Dijkstra’s Algorithm Selects the Next Closest Vertex
28:35 Dijkstra Correctness Uses the Algorithm’s Vertex Order
36:20 Tentative Distances Avoid Recomputing Old Candidates
40:20 Binary Heaps Improve Dijkstra’s Runtime
45:10 Fibonacci Heaps Reduce Decrease-Key Costs
54:45 Shortest Walks with an Even Number of Edges
1:00:15 Two-Edge Shortcuts Work but Can Create a Dense Graph
1:04:50 Why a Sparse Reduction Needs to Track Route State
1:09:55 Parity Layers Generalize to Modulo-5 Path Constraints

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:05 Okay, so last time we did our first graph lecture about desperate search and stuff. So hopefully maybe you've had a chance to look at uh last year's video or something. But today we'll do another graph lecture. It'll be about shortest paths. So, okay, here's maybe uh in the simplest case, uh we might add edge lengths later, but I just want to get from S on the left to T on the right and hop through as few edges as possible. Yeah, while traversing as few edges as possible. Uh, every year I realize I forgot to put an arrow on this. Maybe this edge you can go both directions or something. Okay.

0:57 Trying to get from left to right with as few edges as possible. Anyone find a one of these pass? >> You got four? >> Seven. >> Seven. Anyone else get seven? Anyone beat seven? All right. I'll start with my my pen and you just kind of tell me like whether to go like right, left, or whatever. Okay. Okay. So, here I guess you can go up right or down right. >> Down right.

1:45 >> Down right. Okay. Uh down right or right? >> Right. Upright or right? >> Okay. Uh upright or right? >> Oh no. Uh upright or down right? >> Oh, you got to pick one. Okay. Go down right. I guess you could have gone down left. Uh here I guess you can only pick one if you're doing a path and then presumably this is the last edge. Okay, so that's 1 2 3 4 five six seven. Can anyone do better? Anyone did better? Maybe one thing worth pointing out is that it is it seems pretty good in so far as none of us have beat it, but it's

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Kent Quanrud.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.