Save this video free

The longest path

Kent Quanrud · 1:13:17 · Watch on YouTube

Part of Purdue University Fundamental Algorithms (Fall 2026). See all 21 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 contrasts longest-path algorithms on directed acyclic graphs (DAGs) with the hardness of Hamiltonian path in general directed and undirected graphs. He derives a cached recurrence running in O(V+E) for DAGs, then sketches reductions from 3SAT to directed Hamiltonian path and from directed to undirected Hamiltonian path using variable ladders, clause detours, and in/out vertex gadgets. The lecture also connects Hamiltonian path to Hamiltonian cycle and shows how a general graph coin-collection problem can be reduced to a DAG problem by collapsing strongly connected components.

Key takeaways

Chapters

0:00 Why Simple Problems Can Encode SAT
4:02 Longest Path, Hamiltonian Path, and Three Graph Settings
10:03 DAG Longest Walk via a Cached Recurrence
16:39 Why Hamiltonian Path Makes General Directed Graphs Hard
22:00 Variable Ladders Encode True-or-False Assignments
27:20 Clause Vertices Become Detours Along Variable Rungs
36:00 Proving the 3SAT-to-Hamiltonian-Path Reduction
43:03 Why Undirected Hamiltonian Path Needs a New Gadget
50:05 Split Each Directed Vertex into In and Out Copies
56:40 Reading Hamiltonian Paths from the In-Out Construction
59:25 Hamiltonian Cycle and the Cost of Endpoint Choices
1:03:27 Turn Hamiltonian Path into Hamiltonian Cycle with a Supervertex
1:07:10 Coin Collection on Graphs and the Hidden DAG
1:09:00 Strongly Connected Components Reduce Coin Collection to a DAG

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

Transcript excerpt

0:05 Okay. So, uh, today we're going to do something, uh, it's called longest path. You've done shortest path, so we're going to do longest path today. So, it's going to be back in graphs, but let me sorry. >> Oh, I think graphs are fun. >> I think usually students like graphs more >> because you can draw pictures and stuff. >> It's like better than FFT, right? Like thing. Okay. Um okay so just to remind us where we were at even starting before our first midterm we started looking at uh we first started with this problem SAT where you're just given a boolean formula you want to know if it's satisfiable it seems like it's something a computer could do but the big question is can you get an algorithm or not we don't actually know the answer okay although you might reason that like it might be too good to be true to solve

0:56 but what we can do is we can you know we can look at special cases and things like this and there we also found it was hard um so you know down here in this corner that was the first time we did this kind of funny result which was like well I don't know if there's an algorithm for threesat but I do know that an algorithm for threesat would solve boolean sat that leads me to think maybe threesat doesn't have an algorithm yeah and that's that should have been a new kind of at least I had never seen anything like that before uh we took it up one more notch and we looked at two very similar looking problems. One was twosat, two variables per clause, one was max two sat. Also two variables per clause, but the goal

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.