You are on page 1of 17

Shortest Path Algorithms: Part 5

Gaurav S. Kasbekar
Dept. of Electrical Engineering
IIT Bombay

1-1
References
1) Slides by Kurose and Ross available at:
http://ctas.poly.asu.edu/millard/CET459/lectno/K%
20-%20R%20stuff/index.html
2) Bertsekas and Gallager, Chapter 5.

1-2
Recall: Distributed Asynchronous Bellman-Ford
Algorithm
 Each node v maintains D(v): current estimate of
cost of shortest path from itself to destination u
 D(u) = 0 (does not change)
Algorithm at Node vu:
 Initialization: D(v) = c(v,u) if edge (v,u) exists,
else ∞. Node v sends D(v) to each of its
neighbors
 Whenever an estimate D(.) is received from a
neighbor:
1) Update D(v) using 𝐷 v = 𝑚𝑖𝑛𝑤 (𝑐 𝑣, 𝑤 + 𝐷 𝑤 )
2) If D(v) changes, node v sends updated value to
each neighbor
Changes in Link Costs
 In practice, costs of links may change with
time
 E.g., links may fail partially or fully or may
be restored
 If cost of a link (v,w) changes, nodes v and
w detect change, update their distance
estimates using new link cost and inform
neighbors if estimates change and so on
 This continues until algorithm converges to
shortest paths with new link costs
5-4
Example: Decrease in Link Cost

D(y) D(z)

4 5

5-5
Example: Increase in Link Cost
D(y) D(z)

4 5

• Algorithm takes large number of 9


iterations (47) to converge after … …
link cost increases
48
• “Good news travels fast, bad news
travels slowly” phenomenon/ 49
“count-to-infinity problem” 50
• Before the algorithm converges, z
50
is next-hop on shortest path of y
to x and vice-versa 51
• Routing loop exists
Poisoned Reverse
D(y) D(z) ෩ (𝑧)
𝐷

4 5 

60

50

50

51

• If y is next-hop neighbor of z on shortest path to x, then z


tells y that D(z) = 
• Denote value of D(z) at y as 𝐷(𝑧)

• But this does not solve problem of slow convergence
after link cost increase in all cases
Distributed Asynchronous Bellman-Ford
Algorithm: Taking Link Cost Changes into Account

Algorithm at Node vu:


 Initialization: D(v) = c(v,u) if edge (v,u) exists,
else ∞. Node v sends D(v) to each of its
neighbors
 Whenever an estimate D(.) is received from a
neighbor or link cost to some neighbor changes:
1) Update D(v) using 𝐷 v = 𝑚𝑖𝑛𝑤 (𝑐 𝑣, 𝑤 + 𝐷 𝑤 )
2) If D(v) changes, node v sends updated value to
each neighbor
Convergence to Shortest Path Costs
Theorem:
 Suppose some link costs change and no further
changes in link costs occur
 The estimates D(v) at all nodes converge to the
correct shortest path costs 𝐷∗ v after execution
of a finite number of updates and do not change
thereafter
 true regardless of the order in which different nodes
perform updates and exchange messages and of the
initial values of the estimates D(v)
 Proof omitted: see Bertsekas and Gallager, Sec.
5.2.4
 Exercise: Verify that the arguments used to prove
convergence in the case without link cost changes
no longer hold
Practical Implementation
 Each router needs to know shortest path
to every destination
 Instead of a single distance estimate D(v),
router v maintains a vector of estimates
{D(v,u): uN} to all routers
 Each component of vector updated using
above rules, entire vector exchanged with
neighbors
 Called “distance vector” algorithm
 Minimizers w in update equation provide
next-hop on shortest path
5-10
Practical Implementation
 At any point in time, if v receives a packet
destined for u, it uses the latest values of
distance estimate and next-hop it has
 Routing loops occasionally exist
 Algorithm automatically adapts itself to
link cost changes and updates routes

5-11
Routing in the Internet

5-12
Motivation
 Natural approach: use Dijkstra’s or Bellman-
Ford algorithm for routing throughout Internet
 Shortcomings:
1) Scale: Millions of routers
▪ large overhead in distributing topology and link costs
in Dijkstra’s algorithm, slow convergence of Bellman-
Ford algorithm
2) Administrative Autonomy: An ISP or company
may want to:
▪ implement a routing algorithm of its own choice in
its network
▪ hide internal organization of its network from
outside world 5-13
Hierarchical Routing
 Routers organized into multiple Autonomous
Systems (AS)
 each AS: a group of routers
 All routers within AS:
 run same routing algorithm (e.g., Dijkstra’s or
Bellman-Ford) for intra-AS routing,
 under common administrative control (e.g., operated
by same ISP/ part of same company network)

5-14
Intra and Inter-AS Routing
 Most popular routing algorithms for Intra-AS routing:
 Routing Information Protocol (RIP): an implementation of
Bellman-Ford algorithm
 Open Shortest Path First (OSPF): an implementation of
Dijkstra’s algorithm
 Inter-AS routing:
 node ids (IP addresses) in Internet assigned such that
common prefixes exist (see fig.)
 routing protocol finds routes to prefixes, instead of to
individual nodes

5-15
Inter-AS Routing (contd.)
 Border Gateway Protocol (BGP) used for inter-AS
routing throughout Internet
 One or more routers within each AS act as gateway
routers
 e.g., routers 3a, 1c, 1b, 2a in fig
 Routes determined via exchanges between gateway
routers taking into account customer-provider and
peering arrangements between different ISPs

5-16
Note: Relation Between “ISP” and “AS”

❑ Recall: Internet consists of hierarchical interconnection of


ISPs
❑ Often, entire network of an ISP is an AS
❑ Some large ISPs divide their networks into multiple ASs

1-17

You might also like