Dijkstra's Algorithm Shortest Path First (SPF) : Presented by Sajid Ali Hidaya ID: 5287
Dijkstra's Algorithm Shortest Path First (SPF) : Presented by Sajid Ali Hidaya ID: 5287
www.math.bas.bg/.../EWDwww.jpg
Contributed to :
Shortest path-algorithm, also known as
Dijkstra's algorithm;
Reverse Polish Notation and related
Shunting yard algorithm; t
THE multiprogramming system;
Banker's algorithm;
Self-stabilization an alternative way to
ensure the reliability of the system.
DIJKESTRAS ALGORITHM
OR SHORTEST PATH FIRST
Dijkstra's algorithm is used in SPF, Shortest Path First,
which is used in the routing protocol OSPF, Open
Shortest Path First
Routing :
A protocol that specifies how routers communicate
with each other, disseminating information that
enables them to select routes between any two nodes
on a computer network.
www.criticalblue.com
; http://www.dgp.toronto.edu/people/JamesStewart/270/9798s/Laffra
STEP
2
Red arrows point to nodes reachable from nodes that already have a final distance.
The distance to: b=4, e=33, g=23. Node b has the minimum distance.
Any other path to b visits another red node, and will be longer than 4.
On the next step, node b will be colored orange to indicate 4 is the length of the
shortest path to b.
STEP
3
Red arrows point to nodes reachable from nodes that already have a final distance.
The distance to: c=6, e=16, g=23. Notice that the distance to e, has changed!
Node c has the minimum distance.
There are no other arrows coming in to c.
On the next step, node c will be colored orange to indicate 6 is the length of the
shortest path to c.
STEP
4
Red arrows point to nodes reachable from nodes that already have a final distance.
The distance to: e=16, f=80, g=23, j=18. Node e has the minimum distance.
There are no other arrows coming in to e.
On the next step , e will be colored orange to indicate 16 is the length of the shortest
path to e.
STEP
5
Red arrows point to nodes reachable from nodes that already have a final distance.
The distance to: f=80, g=23, h=49, j=18. Node j has the minimum distance.
Any other path to j visits another red node, and will be longer than 18.
Node j will be colored orange to indicate 18 is the length of the shortest path to j.
STEP
6
Red arrows point to nodes reachable from nodes that already have a final distance.
The distance to: f=26, g=23, h=49. Notice that the distance to f, has changed!
Node g has the minimum distance.
Any other path to g visits another red node, and will be longer than 23.
Node g will be colored orange to indicate 23 is the length of the shortest path to g.
STEP
7
Step 7: Red arrows point to nodes reachable from nodes that already have a final
distance.
The distance to: f=26, h=33. Notice that the distance to h, has changed!
Node f has the minimum distance.
Any other path to f visits another red node, and will be longer than 26.
Node f will be colored orange to indicate 26 is the length of the shortest path to f.
STEP
8
Step 8: Red arrows point to nodes reachable from nodes that already have a final
distance.
The distance to: h=33, i=37. Node h has the minimum distance.
Any other path to h visits another red node, and will be longer than 33.
Node h will be colored orange to indicate 33 is the length of the shortest path to h.
Last
step
Step 9: Red arrows point to nodes reachable from nodes that already have a final
distance.
The distance to: i=37. There are no other arrows coming in to i.
Node i will be colored orange to indicate 37 is the length of the shortest path to i.
Algorithm has finished, follow orange arrows from start node to any node to get
the shortest path to the node. The length of the path is written in the node.
Reference :
Introduction to Algorithms by Cormen, Leiserson and
Rivest (MIT Press/McGraw-Hill 1994, ISBN 0-262-031418 (MIT Press) and ISBN 0-07-013143-0 (McGraw-Hill).
http://en.wikipedia.org/wiki/BellmanFord_algorithm
http://en.wikipedia.org/wiki/Dijkstra_algorithm
www.Criticalblue.com
http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic
29/
Introduction to Algorithms by Cormen, Leiserson and
Rivest (MIT Press/McGraw-Hill 1994, ISBN 0-262-031418 (MIT Press) and ISBN 0-07-013143-0 (McGraw-Hill).