Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Run Dijkstra-like relaxation with visited set and smallest-unreached node in O(V²). Initialize source distance to 0 and repeatedly relax outgoing edges.
Each step finalizes the node with smallest tentative distance, then relaxes edges. This guarantees shortest distances in non-negative weighted graphs.
Updated Feb 2026