Skip to content

Dijkstra's Algorithm

TMGilchrist edited this page Feb 15, 2019 · 5 revisions

Overview

Between the two points,
Consider each node for weight,
And find short path

Dijkstra's algorithm is a graph-traversal algorithm often used for pathfinding. It was first described by Dijkstra in 1959 [1] and formed the basis for the A* pathfinding algorithm [2].

The algorithm is effective when finding the shortest path to go to another place, so that the final path isn't considered too harmful. However, it lacks the computational optimisation introduced by A* [citation needed], and since the difference between their implementation is quite minute, it is often preferable to use the latter. This is especially true in time-intensive software such as games [cite game AI?].

Method

Animated depiction of Dijkstra's algorithm
Animated depiction of Dijkstra's algorithm in play. Image from [3].

The algorithm can be summarised into the following steps:

    1. "Open" the beginning node on the graph
    1. Until the total list of nodes is exhausted or the destination is found:
    • Find the open node with the lowest running 'weight' (e.g. distance)
    • 2.1. Check the running 'weight' (e.g. distance) of each node neighbouring the currently opened node.
    • 2.2. Open the node

(THIS NEEDS FINISHING)

References

Clone this wiki locally