Professional Documents
Culture Documents
✓ Routing Algorithms
Reference Material: Computer Networking: A Top-Down Approach, 8th Edition by Kurose and Ross, Section 5.1, 5.2, 5.2.2
Bellman-Ford Example
Suppose that u’s neighboring nodes, x,v,w, know that for destination z:
Dv(z) = 5 Dw(z) = 3 Bellman-Ford equation says:
5
Du(z) = min { cu,v + Dv(z),
3 w
v 5 cu,x + Dx(z),
2
u 2 1 z cu,w + Dw(z) }
3
1 2
= min {2 + 5,
x 1
y 1 + 3,
5 + 3} = 4
Dx(z) = 3
node achieving minimum (x) is
next hop on estimated least-
cost path to destination (z)
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
g h i
1 1
a b c
8 1
t=1 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
a
compute compute
b compute
c
8 1
t=1 1 1
All nodes:
▪ receive distance
vectors from
neighbors d
compute compute
e compute
f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors
g
compute h
compute compute
i
1 1
a b c
8 1
t=1 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
a b c
8 1
t=2 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
compute
a compute
b compute
c
2 1
t=2 1 1
All nodes:
▪ receive distance
vectors from
neighbors compute
d compute
e compute
f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors
g
compute compute
h compute
i
8 1
a b c
8 1
t=2 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
…. and so on
g h i
1 1
g h i
1 1
d b(a}} = 1 + 8 = 9
Dc(a) = min{cc,b+D e f
DV in c:
Dc(b) = min{cc,b+Db(b)} = 1 + 0 = 1
Dc(a) = 9
Dc(d) = min{cc,b+Db(d)} = 1+ ∞ = ∞ Dc(b) = 1
Dc(e) = min{cc,b+Db(e)} = 1 + 1 = 2 Dc(c) = 0
Dc(d) = 2
Dc(f) = min{cc,b+Db(f)} = 1+ ∞ = ∞
Dc(e) = ∞
Dc(g) = min{cc,b+Db(g)} = 1+ ∞ = ∞ * Check out the online interactive
Dc(f) = ∞ exercises for more examples:
Dc(h) = min{cbc,bg+Db(h)} = 1+ ∞ = ∞ h Dc(g) = ∞ i http://gaia.cs.umass.edu/kurose_ross/interactive/
Dc(i) = min{cc,b+Db(i)} = 1+ ∞ = ∞ Dc(h) = ∞
Dc(i) = ∞
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
DV in b:
Distance vector example: computation Db(a) = 8 Db(f) = ∞
DV in d: Db(c) = 1 Db(g) = ∞
Dc(a) = 1
Db(d) = ∞ Db(h) = ∞ DV in e:
Db(e) = 1 Db(i) = ∞
Dc(b) = ∞ De(a) = ∞
Dc(c) = ∞ De(b) = 1
Dc(d) = 0 a b c De(c) = ∞
Dc(e) = 1 8 1 De(d) = 1
Dc(f) = ∞ De(e) = 0
t=1 Dc(g) = 1
1
Q: what is new DV computed in e at
1t=1?
De(f) = 1
De(g) = ∞
Dc(h) = ∞
▪ e receives DVs Dc(i) = ∞ De(h) = 1
from b, d, f, h De(i) = ∞
DV in h: d compute
e
1
f DV in f:
Dc(a) = ∞ 1
Dc(b) = ∞ Dc(a) = ∞
Dc(c) = ∞ Dc(b) = ∞
Dc(d) = ∞ Dc(c) = ∞
1 1 1 Dc(d) = ∞
Dc(e) = 1
Dc(f) = ∞ Dc(e) = 1
Dc(g) = 1 Dc(f) = 0
Dc(h) = 0 Dc(g) = ∞
g h i Dc(h) = ∞
Dc(i) = 1 1 1
Dc(i) = 1
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
from
from
y ∞∞ ∞ y 2 0 1 Dx(z) = min{cx,y+ Dy(z), cx,z+ Dz(z)}
z ∞∞ ∞ z 7 1 0
= min{2+1 , 7+0} = 3
cost to y
Dy() x y z 2 1
Dx(y) = min{cx,y + Dy(y), cx,z+ Dz(y)}
x ∞ ∞ ∞ = min{2+0 , 7+1} = 2 x z
7
from
y 2 0 1
z ∞∞ ∞
cost to
Dz() x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
from
from
y ∞∞ ∞ y 2 0 1
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
y 2 0 1 from y 2 0 1
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
from
y 2 0 1 y 2 0 1
from
y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi