AI engineering glossary · Data structures algorithms

What is Floyd-Warshall algorithm?

Floyd-Warshall algorithm: A dynamic programming algorithm that computes shortest paths between every pair of vertices by gradually allowing more vertices as intermediate stops. It runs in O(V^3) time and works with negative edges but no negative cycles.

Level: advancedTopic: Data structures algorithms

Floyd-Warshall algorithm: an example

For a 200-city network it produces a full 200 by 200 table of shortest distances in about 8 million steps.

Related terms

More Data structures algorithms terms

Where you learn it

Floyd-Warshall algorithm is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.