Distance vector Algorithm

advertisement
Distance vector Algorithm
(based on text, p. 360)
The algorithm is run at each node x.
N is the set of nodes in the network.
c(x,y) is the cost associated with the edge between x and y
At node x
Initialization:
for each node y directly attached to x (i.e. a neighbor of x):
Dx(y) = c(x,y)
for each node w that is a neighbor of x and all destinations y
in N
Dw(y) = infinity
Send Dx(y) to each neighbor of x
Loop
wait (until a link cost change from x to a neighbor or until a
new distance vector from a neighbor arrives)
for each y in N
Dx(y) = minv{c(x,v) + Dv(y)}
The minimum is taken over all nodes v that are
neighbors of x.
If the distance vector for x changes, send it to all
neighbors.
End Loop
Download