First page Back Continue Last page Graphics
Shortest Path
Dijkstra’s general algorithm computes a value w (weight) for each node v in a graph. W is the smallest cost possible to get to v from a particular vertex 0.
If 0 is your starting point (city) then the weight w at any node v is the minimum distance required to get from the starting point (0) to city v.
We need to also know how to get to v so we will eventually have to keep a bit more information at each node than just w so that the proper path information can be recovered as well.