Contents    Page-10    Prev    Next    Page+10    Index   

Dijkstra's Algorithm

Dijkstra's algorithm finds the shortest path to all nodes in a weighted graph from a specified starting node.

Dijkstra's algorithm is a good example of a greedy algorithm, one that tries to follow the best-looking possibility at each step.

The basic idea is simple:

When we get done visiting all nodes, each node has a cost and a path back to the start; we can reverse that to get a forward path.