Visualize Dijkstra's algorithm for finding shortest paths in weighted graphs
1. Algorithm Manual
2. Build Network
3. Algorithm Parameters
4. Visualization
Dijkstra's Algorithm Manual
Learn about Dijkstra's algorithm before using the tool. Dijkstra's algorithm finds shortest paths from a single source in weighted graphs with non-negative weights.
Algorithm Steps
Initialization: Set distance to source as 0 and all other distances as ∞. Create a priority queue with all nodes.
Main Loop: While the priority queue is not empty, extract the node with minimum distance.
Relaxation: For each neighbor of the current node, update distances if a shorter path is found.
Completion: When all reachable nodes are processed, the algorithm terminates.
Pseudocode
function Dijkstra(graph, source):
// Initialize distances and predecessors
for each vertex v in graph:
dist[v] = INFINITY
prev[v] = UNDEFINED
dist[source] = 0
// Create a priority queue
Q = new PriorityQueue(all nodes)
while Q is not empty:
u = Q.extractMin() // Node with smallest distance
for each neighbor v of u:
alt = dist[u] + weight(u, v)
if alt < dist[v]:
dist[v] = alt
prev[v] = u
Q.decreaseKey(v, alt)
return dist, prev
Key Features
Finds shortest paths in graphs with non-negative weights
Uses a greedy approach with priority queue
Time complexity: O((V+E) log V) with binary heap
Does not work with negative weight cycles
Applications
GPS navigation systems
Network routing protocols
Social network analysis
Transportation and logistics
Ready to Start?
Click the button below to begin building your graph and running Dijkstra's algorithm.
Build Your Network
Select airports to include in your network. Air distances will be automatically calculated.
Select Airports
Hold Ctrl/Cmd to select multiple airports
Network Preview
100%
Algorithm Parameters
Configure Dijkstra's algorithm parameters for your network.
Configuration
The algorithm will find shortest paths from this airport
Algorithm will find the shortest path to this airport
Total airports in your network
Network Summary
Airports0
Possible Routes0
Connected ComponentsUnknown
Algorithm Information
Dijkstra's algorithm will process airports in order of increasing distance from the source.
Time complexity: O((V+E) log V)
Step-by-Step Visualization
Visualize Dijkstra's algorithm step by step with detailed explanations.
Step:0of0
Current Status
Algorithm not started
Distance Array (D)
N/A
Predecessor Array (P)
N/A
Step Details
No step details available. Start the algorithm to see step-by-step details.
Algorithm Visualization
100%
Shortest Path Results
No results available. Run the algorithm to see the shortest path.