|
Problem:
|
|
linkcost[i][j] = Link costs stored in an adjacency matrix |
|
|
|
/* ------------------------
Initialization
------------------------ */
ReachSet := {S} (S is the node that performs the computation)
for ( all other nodes n ≠ S ) do
{
D(S,n) = linkcost(S,n); // Min. cost S -> n
}
|
/* ------------------------
Initialization step
------------------------ */
ReachSet := {S} (S is the node that performs the computation)
for ( each node n in N - {S} ) do
{
D(S,n) := linkcost(S,n); // Min. cost S -> n
Add (S,n) to candidate edges // Candidate edges may be part of shortest path
}
|
|
Distance matrix
To:
From A B C D E
------+---------------------------------
A | * 5 10 * *
B | 5 * 3 11 *
C | 10 3 * 2 *
D | * 11 2 * 3
E | * * * 3 *
|
|
(B,C)
(B,A)
(C,D)
(D,E)
|