1 / 32

Chapter 5

Chapter 5. Routing Algorithm in Networks. Routing Algorithm in Networks. How are message routed from origin to destination? Circuit-Switching → telephone net. Dedicated bandwidth (path) Message-switching : using routing table share link bandwidth concept, 同一 msg 用同一 path

moke
Télécharger la présentation

Chapter 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5 Routing Algorithm in Networks

  2. Routing Algorithm in Networks • How are message routed from origin to destination? • Circuit-Switching → telephone net. Dedicated bandwidth (path) • Message-switching : using routing table share link bandwidth concept, 同一msg用同一path • Packet-switching : 不同路徑for every packet out of order.

  3. Routing Algorithm in Networks • Virtual circuit • – msg delivered in the order transmitted • – sharing, i.e. no dedicated paths. • Implementation • centralized ─ • distributed 1 2 4 1 1 1 2 1 3 6 3 5 6 1 5 4 1 Out of order Re-assembly problem Vulnerable to failure Comm. Of control infomation

  4. Shortest Path Algorithm -Graph • G = (V, A) • dij is the src weight of (i, j) A. • dij =  if (i, j) A. • Source node is node 1 # of nodes |V|=N Set of nodes Set of Direct arcs

  5. §5.2.3 Shortest Path • P.396 §Bellman-Ford Alg. (can handle negative weights but not negative cycles) • Let Di(h) be the length of a shortest path from 1 to i using h or fewer arcs (or links) • Initially D1(0) = 0 Di(0) = , i  1 • For each h = 0, 1, 2,…, N-2

  6. §5.2.3 Shortest Path • [Thm] : The alg. Finds the correct shortest path lengths proof by induction. are the lengths of the shortest path using 1 or fewer links.

  7. §5.2.3 Shortest Path • Induction step : suppose Di(h) are the correct length of shortest paths using h or fewer links. k1 dk1i dk2i k1 i dk3i k1

  8. §5.2.3 Shortest Path • Complexity: • The alg. Requires at most N-1 iterations. • For each iteration, the recursion is performed by N-1 nodes. • Each application of the recursion requires no more than N-1 addition & comparisonsO(N3) complexity. Example : see P.397. Fig 5.31

  9. §Dijkstra’s Algorithm.(position arc weights only.) • Let p be the set of nodes that are permanently labeled. • Step 0 : set P={1}, D1 = 0, and Dj = d1j, j  1 • Step 1 : Find i  P, s.t.

  10. §Dijkstra’s Algorithm.(position arc weights only.) • Step 2 :

  11. §Dijkstra’s Algorithm.(position arc weights only.) • After k iterations of the algorithm. P contains the k+1 nodes that are closest to node 1 and their permanent labels are the correct shortest path lengths from node 1. 1 2 4 1 1 2 1 6 3 5 1 2 1

  12. §Dijkstra’s Algorithm.(position arc weights only.) • Proof by inductions: • True for k=1: • Inductive step: suppose statement is true for any k. P={1, i1,i2,…,ik} are (k+1) closest nodes to 1. Dk is length of the shortest path from 1 to k, kP.

  13. §Dijkstra’s Algorithm.(position arc weights only.) ik-1 ik+1 i ik i1

  14. §Dijkstra’s Algorithm.(position arc weights only.) • By construction, ik+1 is at least as close to 1 as any other node in • Complexity: • The algorithm requires N-1 iterations. • For each iteration: • Step 1 : requires at most N comparison • Step 2 : requires at most N addition & comparisons. complexity is O(N2)

  15. §Floyd-Warshall algorithm • Finds shortest path between every pair of nodes O(N3) • Negative arc weights(but no negative cycle) Note: every pair Bellman-Ford O(N4) Dijkstra O(N3)

  16. §Floyd-Warshall algorithm • Dij(n) = shortest path length between nodes I and j using only nodes 1,2,3…n as intermediate nodes on paths. Initially, Dij(0) = dij For n=0,1,2,…,N-1 Dij(n+1) = min[Dij(n+1) , Di,n+1(n+1)+dn+1,j ] for all i  j

  17. §Floyd-Warshall algorithm • Example see fig.? • Proof by induction : • Complexity : • N iterations • Each iteration require N(N-1) comparisons & additions O(N3)

  18. Centralized, synchronous Bellmen-Ford Algorithm • Let Di(h) be the shortest (<=h) path length from node 1 to node I • Initially, D1(h) = 0 for all h Di(0) =  for i = 1

  19. Centralized, synchronous Bellmen-Ford Algorithm • => h is an index for iteration # (the # of links allowed in paths) ← synchronous • => 有困難 h 必須 all the same

  20. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm • Let Di be the shortest path length from node i to 1. • Let N(i) = { j|(i,j)  A }

  21. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm • Let Di be the shortest path length from node i to 1. • Let N(i) = { j|(i,j)  A } Neighbor • At each time t, each node i  1 has available: • Dji(t) : i’s latest estimate (sent by node i) of the shortest distance from node j  N(i) to node 1. • Di(t) : i’s latest estimate (computed by node i) of the shortest distance from node i to 1

  22. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm • At each point in time, each node. i  1 is doing one of the followings : • Node i update Di(t) by And leaves the estimate Dji(t), j  N(i) unchanged & sends Di, j  N(i) • Node i receives from one or more neighbors Di , j  N(i) computed by j at an earlier time. Node i update Dji(t) and leaves other estimate unchanged. • Node i is idle.

  23. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm • Prove convergence of the distributed asyn. B-F Alg. • Let Ti be the set of times at which node i update Di(t) • Let Tji be the set of times at which node i update Dj(t) • Let {t0, t1…} be the ordering of

  24. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm • Assumptions: • nodes never stop updateing their estimate Di(t) and receiving msg. from all their neighbors Dji(t), j  N(i), Ti, Tji have  # of elements. • All estimates Di(t), Dji(t), i  V, j  N(i) are non-negative. • Old distance information is eventually purged from the system.

  25. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm • Let Dik be the k-th iteration of Bellman-Ford (k=0,1,2…) for node i = 1,2,…N when • Let Dik be the k-th iteration of Bellman-Ford when Di(0) = 0, i = 1,2,…N

  26. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm

  27. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm

  28. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm

  29. § 5.2.4 Distributed Asynchronous Bellman-Ford Algorithm

More Related