Dijkstra Algorithm Calculator & Visualizer
Step-by-step Dijkstra shortest path algorithm runner with distance tables, priority queue state, and edge relaxation logs.
Dijkstra's Algorithm
Enter your custom input data → Run the real algorithm engine → Observe step transitions.
⚙️ Customize Algorithm Input Data
Initialized source node A
Dijkstra begins greedily at the start node
Set dist[A] = 0 and all other nodes to Infinity
Interactive SVG Graph Canvas
Mathematical Formula
Overview & Explanation
Dijkstra algorithm calculates the shortest path from a starting node to all other nodes in a weighted graph with non-negative edge weights.
How It Works
- Initialize distance of start node to 0 and all other nodes to Infinity.
- Extract unvisited node with smallest tentative distance.
- Relax all outgoing edges to unvisited neighbors.
- Repeat until all reachable nodes are visited.
Practical Applications
- GPS Routing & Mapping (Google Maps)
- Network Packet Routing (OSPF protocol)
Dijkstra Step-by-Step Example
Shortest path on graph A-B(4), A-C(2), C-B(1), C-D(5), B-D(2)
Init
Extract A (dist 0)
Extract C
Extract C (dist 2)
Extract B
Extract B (dist 3)
Complete
Reconstruct Path
Frequently Asked Questions
Why does Dijkstra fail with negative edge weights?
Related Calculators
Kruskal's Minimum Spanning Tree Visualizer
Step-by-step Kruskal's MST calculator showing sorted edge processing, disjoint-set (DSU) cycle checks, and accepted/rejected edges.
Breadth First Search (BFS) Visualizer
Step-by-step BFS graph traversal visualizer tracking queue operations and visited node sets.
Bubble Sort Visualizer & Step Calculator
Interactive step-by-step Bubble Sort execution visualizer with comparisons, swaps, and time complexity breakdown.