Weighted Graph Shortest Route Calculator
Find a least-cost route through a small directed or undirected edge graph with nonnegative costs.
YOUR CALCULATION
Result
—
Calculation steps
Work through one step at a time or reveal the complete calculation. The steps use your current inputs.
How to calculate
Build adjacency lists and use Dijkstra’s algorithm to settle the least-cost unreached node. Keep predecessors to recover one shortest route.
Relax edge u→v when distance(u)+cost(u,v)<distance(v)
Worked example
With edges A→B=4, A→C=1, C→B=2, B→D=1, C→D=5, the shortest A-to-D route is A→C→B→D at total cost 4.
Assumptions and input details
One to two hundred edges and at most 100 distinct case-sensitive nodes; labels at most 40 characters. Costs are nonnegative and share your chosen meaning/unit; zero edges and parallel edges are allowed. Start and destination must occur in the edge list. Negative costs, road maps, live travel times and turn restrictions are unsupported. When routes tie, one route from the input order is retained, without enumerating every tied path. An unreachable destination is explicitly reported.
Using this calculator
Can I enter my own problem?
Yes. Replace the example values with your own inputs. The result, calculation steps, tables and applicable diagrams update from those inputs. Blank or invalid values clear the result; example values are never silently substituted for missing inputs.
Are the results exact?
Results use floating-point arithmetic and displayed rounding. Read the formula, assumptions and any stated data precision before interpreting the result.
Is my input uploaded?
The calculation runs in your browser. No account, file upload or external AI service is required. Inputs are not saved between page reloads.
Calculate earliest and latest task times, total slack and critical tasks in a dependency network.
Plan a sequence of entered distances, average speeds and breaks with dated arrival times.
Estimate first and final packet arrival over equal-rate store-and-forward links, including packet overhead and per-hop propagation.
Reserved advertising space.