0Pricing
Competitive Programming Academy · Lesson

Floyd-Warshall All-Pairs

Shortest paths between every pair.

Every Pair at Once

Sometimes you need the shortest path between every pair of nodes, not just from one source. That is the all-pairs problem.

Meet Floyd-Warshall

Floyd-Warshall fills a full distance table for all pairs with three tidy nested loops and almost no setup.

All lessons in this course

  1. Dijkstra with a Heap
  2. 0-1 BFS with a Deque
  3. Bellman-Ford & Negative Edges
  4. Floyd-Warshall All-Pairs
← Back to Competitive Programming Academy