ratio.

Find a tool

Browse all tools and categories ↗
GRAPH THEORY

Weighted Graph Shortest Route Calculator

Find a least-cost route through a small directed or undirected edge graph with nonnegative costs.

Enter your values

01 / INPUT
Calculated on your device

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.

    RELATED TOOL · PLANNINGCritical Path and Project Slack Calculator

    Calculate earliest and latest task times, total slack and critical tasks in a dependency network.

    RELATED TOOL · TIMETravel Leg and Arrival Time Calculator

    Plan a sequence of entered distances, average speeds and breaks with dated arrival times.

    RELATED TOOL · COMPUTINGStore and Forward Packet Latency Calculator

    Estimate first and final packet arrival over equal-rate store-and-forward links, including packet overhead and per-hop propagation.

    ADVERTISEMENT

    Reserved advertising space.