Skip to content

    Dijkstra's Algorithm

    Reading time: 2 min.Editorially reviewed on:

    Definition

    Classic graph algorithm for calculating the shortest path between nodes in a network with non-negative edge weights.

    Proceeding from the starting node, the not yet closed node with the smallest known distance is processed in each case. Assuming non-negative edge weights, shortest paths can thus be determined. The weights must match the desired size, such as distance or travel time.

    Simply explained

    Like a way search that compares the totaled route costs. The shortest route corresponds to the fastest only if the weights represent travel times.

    Why it matters in practice

    Relevant for shortest routes in networks; not a complete solution for the optimal sequence of multiple delivery stops.

    Example from business

    Possible example: An application determines the shortest distance from a central office to a single branch in the case of non-negative route weights.

    Limits and pitfalls

    • Use negative edge weights; do not map changing travel times; confuse a single shortest path with the optimal sequence of many delivery stops.

    Origin & history

    Edsger W. Dijkstra published the algorithm in 1959 in “A Note on Two Problems in Connexion with Graphs”.

    Use in mid-sized companies

    • Calculation of individual routes in transport, pipeline or other networks. For complete delivery tours with many stops, additional optimization procedures are necessary.

    Frequently asked questions

    What makes Dijkstra different from A*?

    A* additionally uses a heuristic; a speed advantage depends on the problem and the heuristic.

    Why Are Negative Edge Weights Problematic?

    They violate the premise on which the final closing of a node is based.

    Sources

    Sources checked on 10/09/2026.

    Editorially reviewed on:

    On this page

    Next step

    Put knowledge into practice