Shortest Path Calculator (Dijkstra)
Find the shortest paths in a weighted graph from a source node with Dijkstra's algorithm.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Step 1: Open Shortest Path Calculator (Dijkstra) and add your input
Type your numbers or text, add your file, or pick the options you need. Nothing is uploaded: everything stays in your browser.
- 2Step 2: What Shortest Path Calculator (Dijkstra) does
Find the shortest paths in a weighted graph from a source node with Dijkstra's algorithm.
- 3Step 3: Read the result and compare
The result appears at once. Change one value to see how the answer moves, then keep the figure that fits your case.
- 4Step 4: Copy or save it
Copy the result or download it. For an important decision, confirm it with the official source or an adviser.
About this tool
Type the edges one per line as node, node, weight and choose directed or undirected. The calculator finds the shortest distance from the source to every node and the exact route to your destination.
Method
Dijkstra's algorithm repeatedly settles the nearest unsettled node and relaxes its edges. It needs non-negative weights.
Input
Nodes can be any names without spaces, such as A, B or London. Weights are non-negative numbers. For an undirected graph each edge works both ways.
Worked example
On the classic six-node example the shortest route from A to E is A → C → F → E with total distance 20.
Tips for best results
Check every box before you rely on a result, because one wrong digit changes the whole answer. Use the exact figures from your payslip, bill, certificate or contract, and keep a note of the date you calculated. Rates, thresholds and rules change from time to time, so for tax, fees and legal matters treat the output as an estimate and confirm with the official source named on this page. You can run as many scenarios as you like; nothing is saved or sent, and refreshing the page clears the boxes.
Quick facts
- Category: Math & Science
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in many languages.
- Content last reviewed:
Frequently asked questions
Can weights be negative?
No; Dijkstra's algorithm needs non-negative weights.
What if a node is unreachable?
Its distance is shown as ∞.
Directed or undirected?
Choose in the menu; directed edges go only from the first node to the second.
How many edges?
Up to 500.
