Dijkstra's Algorithm
Bellman-Ford Algorithm
Floyd-Warshall Algorithm
A* Search Algorithm
Dijkstra's Algorithm — Greedy Shortest Path
Picks the unvisited vertex with the minimum known distance at each step. Works only with non-negative edge weights.
Graph (click a node to set as source)
Source
Current
Settled
Relaxed
Unvisited
Press ▶ Run or Step to begin...

Controls

Ready
Time Complexity:
O(V²) with array  |  O((V+E) log V) with Min-Heap PQ

Distance Table

NodeDistancePrevious
Bellman-Ford Algorithm — Dynamic Programming
Relaxes ALL edges V−1 times. Handles negative weights and detects negative cycles. Slower than Dijkstra but more general.
Directed graph with negative edges
Source
Being Relaxed
Finalized
Negative Cycle
⚠️ Negative Weight Cycle Detected! Distances cannot be finalized — the cycle reduces cost infinitely.
Press ▶ Run or Step to begin...

Controls

Iteration: 0 / 0
Ready
Time Complexity: O(V × E)
Space: O(V)

Distance Table

NodeDistancePrevious
Floyd-Warshall Algorithm — All-Pairs Shortest Path
Computes shortest paths between ALL pairs of vertices using dynamic programming. Considers each vertex as a potential intermediate node.
Directed weighted graph
Intermediate (k)
Source (i)
Target (j)
Finalized
Press ▶ Run or Step to begin...

Controls

Intermediate node (k):
Ready
Time Complexity: O(V³)
Space: O(V²)

Distance Matrix

A* Search Algorithm — Heuristic Shortest Path
Combines actual cost g(n) with a heuristic estimate h(n) to efficiently find the shortest path. Uses f(n) = g(n) + h(n) to prioritize exploration.
Grid (click = wall, shift+click = start, ctrl/cmd+click = end)
Start
End
Open Set
Closed Set
Path
Wall
Press ▶ Run or Step to begin...

Controls

Ready
Time Complexity: O(E log V) — depends on heuristic
Space: O(V)

Statistics

Nodes Explored0
Open Set Size0
Path Length
Path Cost