The Art of Computer Networking by Unknown
Author:Unknown
Language: eng
Format: epub
W
1
Y
2
1
3
4
2
V
Z
X
7
Figure 7.5 Example for Dijkstra’s algorithm.
7.3.3
Dijkstra’s Algorithm
We need to take a brief detour to describe Dijkstra’s algorithm. This algorithm is used in several routing protocols to find the best route to a destination, in particular it is used in OSPF, below. Dijkstra’s algorithm is a simple way of computing shortest paths though a
network where ‘shortest’ means ‘least cost’, for whatever cost measure you have chosen.
Suppose we want to find the shortest/cheapest path between V and Z in Figure 7.5,
where the cost of each hop is as indicated. With each node we shall associate a predecessor node and the cost c of getting to that node. Also we shall mark each node as ‘determined’
or ‘undetermined’:
1. Initialize all costs to ∞, predecessor names to blank, and all to be undetermined.
2. Initialize cost of the starting node V to zero.
3. While there are any undetermined nodes:
(a) pick an undetermined node with lowest current cost and call it node C;
(b) mark C determined;
(c) for each undetermined neighbour N of C
if cost to C + cost N to C < cost to N we have found a shorter path to N via
C; make the cost of N be cost to C + cost N to C and the predecessor of N
be C
Determined nodes are those for which we definitely know the cheapest route; undeter-
mined nodes are those where we might yet find a better route.
For example:
Start with
W(∞,–)
1
Y(∞,–)
V
W
X
Y
Z
2
1
3
4
2
0
∞
∞
∞
∞
V(0,–)
Z(∞,–)
X(∞,–)
–
–
–
–
–
Undet Undet Undet Undet Undet
7
132
CHAPTER 7 / ROUTING IP
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Aircraft Design of WWII: A Sketchbook by Lockheed Aircraft Corporation(32129)
The Great Music City by Andrea Baker(30767)
Call Me by Your Name by André Aciman(19886)
The Art of Boudoir Photography: How to Create Stunning Photographs of Women by Christa Meola(18397)
The Secret History by Donna Tartt(18119)
Shoot Sexy by Ryan Armbrust(17548)
Plagued by Fire by Paul Hendrickson(17093)
Portrait Mastery in Black & White: Learn the Signature Style of a Legendary Photographer by Tim Kelly(16861)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(16790)
Photographically Speaking: A Deeper Look at Creating Stronger Images (Eva Spring's Library) by David duChemin(16489)
Ready Player One by Cline Ernest(13953)
Pimp by Iceberg Slim(13766)
Bombshells: Glamour Girls of a Lifetime by Sullivan Steve(13676)
The Goal (Off-Campus #4) by Elle Kennedy(13188)
Art Nude Photography Explained: How to Photograph and Understand Great Art Nude Images by Simon Walden(12845)
Kathy Andrews Collection by Kathy Andrews(11309)
The Priory of the Orange Tree by Samantha Shannon(8574)
Thirteen Reasons Why by Jay Asher(8435)
The remains of the day by Kazuo Ishiguro(8369)
