Routing 1
Routing 1
Decentralized: quickly
router knows physically- – periodic update
connected neighbors, link – in response to link
costs to neighbors cost changes
iterative process of
computation, exchange of
info with neighbors
“distance vector”
algorithms
A Link State Routing Algorithm
5
3
B C 5
2
A 2 1 F
3
1 2
D E
1
Dijkstra’s Algorithm: Discussion
Algorithm complexity: n nodes
each iteration: need to check all nodes, w, not in
N
n*(n+1)/2 comparisons: O(n**2)
more efficient implementations possible:
O(nlogn)
Oscillations possible:
A A A
1e.g., link cost
1+e = amount
2+e 0 of carried
0 traffic2+e A
2+e 0
D B D 1+e1 B D
0 0 0 0 B D 1+e1 B
0 e 0 0 1 1+e 0 e
1
C C C C
1
e
… recompute … recompute … recompute
initially
routing
Distance Vector Algorithm
Overview
Each router starts with a distance table
consisting of the value “0” for itself and the
value “infinity” for every other destination
Each router will transmit its distance vector to
each of its neighbors whenever the
information changes (as well as when a link to
a neighbor first comes up)
Each router saves the most recently received
distance vector from each of its neighbors, and
calculate its own distance vector, based on
minimizing the cost to each destination
Distance Vector Algorithm
iterative:
Distance Table data
continues until no
nodes exchange info. structure
self-terminating: no
each node has its own
“signal” to stop row for each possible
destination
asynchronous: column for each directly-
nodes need not
attached neighbor to node
exchange info/iterate
in lock step!
example: in node X, for dest. Y
via neighbor Z:
distributed: distance from X to
each node X = Y, via Z as next hop
D (Y,Z)
communicates only Z
= c(X,Z) + minw{D (Y,w)}
with directly-
attached neighbors
Distance Table: An Example
destination
E D
D (C,D) = c(E,D) + minw {D (C,w)}
= 2+2 = 4 C 6 9 4
E D
D (A,D) = c(E,D) + min {D (A,w)}
w D 4 11 2
= 2+3 = 5 loop!
E B
D (A,B) = c(E,B) + minw{D (A,w)}
= 8+6 = 14
loop!
Distance Table Gives Routing
Table
cost to destination via
E Outgoing link
D () A B D to use, cost
A 1 14 5 A A,1
B 7 8 5 B D,5
destination
destination
C 6 9 4 C D,4
D 4 11 2 D D,4
Y
2 1
X Z
7
Distance Vector Algorithm:
Example
Y
2 1
X Z X Z
7 D (Y,Z) = c(X,Z) + minw{D (Y,w)}
= 7+1 = 8
X Y
D (Z,Y) = c(X,Y) + minw {D (Z,w)}
= 2+1 = 3
Distance Vector Algorithm: Link Cost
Changes
Link cost changes:
1
node detects local link cost Y
change 4 1
updates distance table (line 15) X Z
50
if cost change in least cost path,
notify neighbors (lines 23,24)
algorithm
terminates
“good
news
travels
fast”
Count to infinity: Another
Example
A B C
1 1
Distance Vector: Link Cost
Changes
Link cost changes: 60
good news travels fast Y
4 1
bad news travels slow -
“count to infinity” problem! X Z
50
algorithm
continues
on!
Distance Vector: Position
Reverse
If Z routes through Y to get to X :
60
Z tells Y its (Z’s) distance to X is infinite (so Y
Y won’t route to X via Z) 4 1
will this completely solve count to infinity X Z
problem? 50
algorithm
terminates
Comparison of LS and DV
Algorithm
Message complexity Robustness: what
LS: with n nodes, E links, happens if router
O(nE) msgs sent each malfunctions?
DV: exchange between LS:
neighbors only
– node can advertise
– convergence time
incorrect link cost
varies
– each node computes
Speed of Convergence only its own table
LS: O(n**2) algorithm DV:
requires O(nE) msgs – DV node can advertise
– may have oscillations incorrect path cost
DV: convergence time – each node’s table used
varies by others
– may be routing loops o error propagate thru
– count-to-infinity network
Summary