Bellman Ford Algorithm
Bellman Ford Algorithm
Routing Table For each destination list: Next Node dest next dist Distance
Table Synthesis Neighbors exchange table entries Determine current best next hop Inform neighbors
Shortest Path to SJ
Focus on how nodes find their shortest path to a given destination node, i.e. SJ
San Jose
Dj
Cij
i
Di
If Di is the shortest distance to SJ from i and if j is a neighbor on the shortest path, then Di = Cij + Dj
San Jose
Dj
Pick current shortest path
j'
Cij'
i
Di
Cij
Cij
j j"
Dj"
3 Hops From SJ
2 Hops From SJ
1 Hop From SJ
San Jose
Hop-1 nodes calculate current (next hop, dist), & send to neighbors
Bellman-Ford Algorithm
Consider computations for one destination d Initialization Each node table has 1 row for destination d Distance of node d to itself is zero: Dd=0 Distance of other node j to d is infinite: Dj=, for j d Next hop node nj = -1 to indicate not yet defined for j d Send Step Send new distance vector to immediate neighbors across local link Receive Step At node j, find the next hop that gives the minimum distance to d,
Minj { Cij + Dj }
Replace old (nj, Dj(d)) by new (nj*, Dj*(d)) if new next node or distance
Go to send step
Bellman-Ford Algorithm
Now consider parallel computations for all destinations d Initialization Each node has 1 row for each destination d Distance of node d to itself is zero: Dd(d)=0 Distance of other node j to d is infinite: Dj(d)= , for j d Next node nj = -1 since not yet defined Send Step Send new distance vector to immediate neighbors across local link Receive Step For each destination d, find the next hop that gives the minimum distance to d,
Go to send step
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
Initial 1 2 3
(-1, )
(-1, )
(-1, )
(-1, )
(-1, )
1
5
4
3 1 3
San Jose
6
2
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
Initial
1 2 3
(-1, )
(-1, )
(-1, )
(-1, )
(-1, )
(6,1)
(-1, )
(-1, )
(-1, )
(6,2)
D3=D6+1 n3=6
2
3 1
2 1
D6=0
1
5
4
3 1 3
0
6
5
2
San Jose
2
4
2
D6=0
D5=D6+2 n5=6
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
Initial
1 2 3
(-1, )
(-1, ) (3,3)
(-1, )
(-1, ) (5,6)
(-1, )
(6, 1) (6, 1)
(-1, )
(-1, ) (3,3)
(-1, )
(6,2) (6,2)
3
1
5 3 1
1
3
3
4
2 3
0
6
5
2
San Jose
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
Initial 1 2 3
3
1
5 3 1
1
2
3
4
2 3
0
6
5
2
San Jose
6 4
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
Initial 1
(3,3) (3,3)
(4,4) (4,4)
(6, 1) (4, 5)
(3,3) (3,3)
(6,2) (6,2)
2
3
1 5 3
1
5 3 1 2
3
2 3 1
3
4
0
6 5
2
San Jose
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
Initial 1
2 3
(3,3) (3,3)
(3,7)
(4,4) (4,4)
(4,4)
(6, 1) (4, 5)
(4, 5)
(3,3) (3,3)
(5,5)
(6,2) (6,2)
(6,2)
37
1
5 3 1
5
2
3
2 3 1
53
4
0
6 5
2
San Jose
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
Initial 1
2 3
(3,3) (3,3)
(3,7) (3,7)
(4,4) (4,4)
(4,4) (4,6)
(6, 1) (4, 5)
(4, 5) (4, 7)
(3,3) (3,3)
(5,5) (5,5)
(6,2) (6,2)
(6,2) (6,2)
7
1
5 3 1
5 7
2
2 3
0
6 5
2
San Jose
2
4
46
Iteration
Node 1
Node 2
Node 3
Node 4
Node 5
1 2 3 4
79
1
5 3 1
7
1
5
4
2 3
0
6 5
2
San Jose
(b)
1
Update
1
Node 1
4
Node 2
Before break
After break
(2,3)
(2,3) (2,3)
(3,2)
(3,2) (3,4)
(4, 1)
(2,3) (2,3)
2
3 4 5
(2,5)
(2,5) (2,7) (2,7)
(3,4)
(3,6) (3,6) (3,8)
(2,5)
(2,5) (2,7) (2,7)
Do not report route to a destination to the neighbor from which route was learned Report route to a destination to the neighbor from which route was learned, but with infinite distance Breaks erroneous direct loops immediately Does not work on some indirect loops
Poisoned Reverse
(b)
Update
Node 1 Node 2
Node 3
Before break
After break 1 2
(2, 3)
(2, 3) (2, 3) (-1, )
(3, 2)
(3, 2) (-1, ) (-1, )
(4, 1)
(-1, ) (-1, ) (-1, )
Node 2 advertizes its route to 4 to node 3 as having distance infinity; node 3 finds there is no route to 4 Node 1 advertizes its route to 4 to node 2 as having distance infinity; node 2 finds there is no route to 4 Node 1 finds there is no route to 4