- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Yen's algorithm for k shortest paths | CS 61B | Ludwig Explains
Dijkstra's algorithm gives you THE shortest path from s to t. But what if you want the second shortest? The third? A ranked list of routes you can fall back on if the primary fails?
That's what Yen's algorithm does. It finds the k shortest loopless paths in a weighted graph. The mechanism is surprisingly clean: every new shortest path must DEVIATE from a previous one at some node. So you enumerate candidate deviations — root path agrees with the previous winner up to node v, then a new "spur" runs Dijkstra from v to t — forbid the edges that would let you rediscover an existing path, and pick the cheapest candidate. Repeat k times.
This video walks through:
- The problem statement (k shortest loopless paths)
- The key insight: deviation points along a known path
- How to compute a deviation: edge removal + forbidden root nodes + Dijkstra
- The full algorithm (A = confirmed paths, B = candidate priority queue)
- A worked example on a 5-node graph
- Time complexity: O(k · n · (m + n log n))
- Where Yen's shows up in practice (network routing, alternate routes, fault tolerance, bioinformatics)
Reference: Yen, J. Y. (1971). "Finding the K Shortest Loopless Paths in a Network." Management Science 17(11): 712–716.
Subscribe for more "making the confusing click": https://youtube.com/@LudwigExplains
#cs #algorithms #graphtheory #shortestpaths #dijkstra #LudwigExplains #cs61b
Видео Yen's algorithm for k shortest paths | CS 61B | Ludwig Explains канала ludwig explains
That's what Yen's algorithm does. It finds the k shortest loopless paths in a weighted graph. The mechanism is surprisingly clean: every new shortest path must DEVIATE from a previous one at some node. So you enumerate candidate deviations — root path agrees with the previous winner up to node v, then a new "spur" runs Dijkstra from v to t — forbid the edges that would let you rediscover an existing path, and pick the cheapest candidate. Repeat k times.
This video walks through:
- The problem statement (k shortest loopless paths)
- The key insight: deviation points along a known path
- How to compute a deviation: edge removal + forbidden root nodes + Dijkstra
- The full algorithm (A = confirmed paths, B = candidate priority queue)
- A worked example on a 5-node graph
- Time complexity: O(k · n · (m + n log n))
- Where Yen's shows up in practice (network routing, alternate routes, fault tolerance, bioinformatics)
Reference: Yen, J. Y. (1971). "Finding the K Shortest Loopless Paths in a Network." Management Science 17(11): 712–716.
Subscribe for more "making the confusing click": https://youtube.com/@LudwigExplains
#cs #algorithms #graphtheory #shortestpaths #dijkstra #LudwigExplains #cs61b
Видео Yen's algorithm for k shortest paths | CS 61B | Ludwig Explains канала ludwig explains
Комментарии отсутствуют
Информация о видео
16 мая 2026 г. 5:20:33
00:04:33
Другие видео канала





















