150 likes | 165 Views
Learn about path selection criteria, least cost algorithms, Dijkstra and Bellman-Ford algorithms for network routing performance evaluation and improvements.
E N D
William StallingsData and Computer Communications7th Edition Chapter 12 Routing
Performance Criteria • Used for path selection • Minimum hop count • Minimum cost
Least Cost Algoritm • Routing decision • Numberof hops • link cost reflects capacity • Network with bidirectional links • Each link has a cost associated in both directions • Path cost equal to sum of link costs • Least cost path searched for each pair of nodes • Costs can be different on diff. directions
Dijkstra Algorithm Definitions • Searches the least cost path from a source node to all other nodes by examining paths of increasing length or number of hops • N = set of nodes of the network • s = source node • T = setul of nodes incorporated in the algorithm • w(i, j) = cost of link from node i to node j • w(i, i) = 0 • w(i, j) = if not directly connected • w(i, j) 0 ifdirectly connected • L(n) = least cost path from node s to n known • At finish, L(n) is the least cost from s to all n
Dijkstra Algorithm Method • Step 1 [Initialization] • T = {s} Source Node • L(n) = w(s, n) for n ≠ s • Initialyonly link costs • Step 2 [Next Node] • Searches neighbour nodenot incorporated in T with minimum cost to s • Incorporate nod in T • Step 3 [Update least cost path] • L(n) = min[L(n), L(x) + w(x, n)] for all n Ï T • If second term is min. update path by concatenation • [Finish ] Algorithm ends when all nodes incorporated in T
Algoritm Dijkstra Observations • At finish, value L(x) asociated to each node x is the cost (lenght) of least cost path from s to x. • T definesthe least cost path from s to every other node • One iterationofsteps 2 and 3 adds a new nodeto T
Algoritm Bellman-Ford Definitions • Find shortest paths from source node such that paths contain at most one link • Find shortest paths such that paths have at most two links • And so on • s = source node • w(i, j) = link cost from node i to node j • w(i, i) = 0 • w(i, j) = if nodes are directly connected • w(i, j) 0 if nodes directly connected • h = maximum number of links in path at current stage • Lh(n) =cost of least-cost path from s to n such that no more than h links
Algorithm Bellman-Ford [Initialization] step 1 L0(n) = , for all n s Lh(s) = 0, for all h [Update] step 2 For each successive h 0: For each n ≠ s, compute Lh+1(n)=minj[Lh(j)+w(j,n)] Connect n with predecessor node j that achieves minimum Eliminate any connection of n with different predecessor node formed during an earlier iteration Path from s to n terminates with link from j to n
Observaţii Algoritm Bellman-Ford • At each iteration of step 2 for h=K and each destination node n, the algorithm compares paths from source s to n of length K+1 with the path from previous iteration • The path with lesser cost is maintained as best cost path
B.-F. vs. Dijkstra • Dijkstra • Each node must know link costs of all links • Information must be exchanged with all other nodes • Both converge under static conditions to same solution • If costs change algorithm will attempt to catch up • If cost depends on traffic • Depends on routes chosen • then feedback condition exists • Bellman-Ford • Link cost to all neighboring nodes to node n [i.e., w(j, n)] plus total path cost to those neighboring nodes from a particular source node s [i.e., Lh(j)] • Each node can maintain set of costs and associated paths for every other node and exchange information with direct neighbors • Each node can use Bellman-Ford based only on information from neighbors and knowledge of its link costs • Instabilities may result