AI engineering glossary · Data structures algorithms

What is Bellman-Ford algorithm?

Bellman-Ford algorithm: A shortest-path algorithm that repeatedly relaxes every edge up to V-1 times, where V is the number of vertices. It handles negative edge weights and can detect a negative cycle, at the cost of O(V*E) time.

Level: advancedTopic: Data structures algorithms

Bellman-Ford algorithm: an example

In a currency exchange graph with log-transformed rates, Bellman-Ford can reveal an arbitrage loop as a negative cycle.

Related terms

More Data structures algorithms terms

Where you learn it

Bellman-Ford 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.