This repository has been archived on 2022-06-22. You can view files and clone it, but cannot push or open issues or pull requests.
usaco-guide/content/3_Gold/Gold_ShortestPath.md
2020-06-03 17:08:42 -04:00

2.5 KiB

Gold - Shortest Path

Author: Benjamin Qi

CPC.7

Find the shortest path where all edge weights are 1.

Tutorial

Problems

Non-Negative Edge Weights

Use Dijkstra's Algorithm.

Tutorial

USACO Gold Problems

All Pairs Shortest Path (APSP)

Use the Floyd-Warshall algorithm.

Tutorial

USACO Gold Problems

Negative Edge Weights

Hasn't appeared in recent USACO Gold as far as I know.

Can also modify Dijkstra's so it works with negative edge weights (but not negative cycles). The same running time bound no longer applies.