Presentation is loading. Please wait.

Presentation is loading. Please wait.

10.- Graph Algorithms Centro de Investigación y Estudios Avanzados del Instituto Politécnico Nacional Introduction Routing Algorithms Computation of Shortest.

Similar presentations


Presentation on theme: "10.- Graph Algorithms Centro de Investigación y Estudios Avanzados del Instituto Politécnico Nacional Introduction Routing Algorithms Computation of Shortest."— Presentation transcript:

1 10.- Graph Algorithms Centro de Investigación y Estudios Avanzados del Instituto Politécnico Nacional Introduction Routing Algorithms Computation of Shortest Path Distance Vector Routing Link-State Routing Interval Routing Sistemas Distribuidos Jorge Antonio Perez Espinoza

2 Graph Graph G: G = (V, E) V = Set of nodes 0….N-1. E = Set of edges representing links: (A,B),(A,C) Each edge w(i, j) has a weight. AA BB EE CC DD 2 4 1 3 1 5

3 Graphs on Distributed System The topology of a distributed system is represented by a graph where the nodes represent processes, and the links represent communication channels. Static vs. Dynamic Topology. AA BB EE CC DD 2 4 1 3 1 5

4 ROUTING ALGORITHMS Routing is a fundamental problem in networks. Discover and maintain an acyclic path from the source of a message to its destination. The routing table is updated when the topology changes. A path can have many attributes: hops, delay.

5 COMPUTATION OF SHORTEST PATH Given a graph G: G = (V, E) V = Set of nodes 0….N-1. E = Set of edges representing links. Each edge w(i, j) has a weight. The topology is static. AA BB EE CC DD 2 4 1 3 1 1

6 Chandy and Misra Algorithm A refinement of the Bellman-Ford Algorithm. Designed to work with a single initiator node 0. D(i): Distance to node 0 Each node knows the weights of all edges incident on it. Initially : D(0) = 0 ∀ i : i > 0 : D(i) = ∞. N0 N1 N2 N4 N5 4 6 5 1 2 3 3

7 For each node: 1. D, the current shortest distance of node 0 to itself. Initially D(0) = 0, D(i: i > 0) = ∞ 2. A node called parent: Initially parent (j) = j 3. A variable deficit, representing the number of unacknowledged messages. Initially deficit=0. N0 N1 N2 N4 N5 4 6 5 1 2 3 3

8 program shortest path {for process i >0}; define D, S : distance; {S denotes the shortest distance received through a message} parent : process deficit : integer; N: set of neighbors of process i; initially D= ∞, parent = i, deficit = 0 {for process 0} send (w(0,i), 0) to each neighbor i; deficit := |N(0)|; do ack -> deficit := deficit – 1 od; {deficit = 0 signals termination} {for process i > 0} do message = (S,k) ^ S send ack to parent fi; parent := k; D := S; send (D + w(i,j), i) to each neighbor j ≠ parent; deficit := deficit + |N(i)| -1 message (S,k) ^ S ≥ D -> send ack to sender ack -> deficit := deficit – 1 deficit = 0 ^ parent ≠ i -> send ack to the parent od N0 N1 N2 N4 N5 4 6 5 1 2 3 3

9 Example

10 Lemma : When the algorithm terminates, let k = parent (i). If D(k) is the distance of the shortest path from k to 0, then D(i) = D(k) + w(k, i) is the distance of the shortest path from i to 0 and the shortest path includes k. Proof: Suppose this is false : The shortest path from 0 to i is via j, where j ≠ k. Message D(i)>D(j)+w(j,i). Message D(i)>D(k)+w(k,i). i K 0 j 1 1 2 2

11 DISTANCE VECTOR ROUTING Shortest path routing, but handles topology changes. Routing Table DestinationNextHopDistance D[i, j] = 0 when i = j, = 1 when j is a neighbor of i, and = ∞ when i = j and j is not a neighbor of i ∀ k ≠ i :D[i,k]=minj(w[i,j]+D[j,k]) Each node j periodically broadcasts its distance vector to its immediate neighbors

12 DISTANCE VECTOR ROUTING RT- U XX1 YX2 VV∞ Following this, the distance vectors are corrected, and routing table is eventually recomputed.

13 Count to Infinity Problem ABC D E 1 1 11 1.- Node A. -> B(A,A,1) 2.- Node B. -> C(A,B,2) 3.- Node C. -> B(A,C,3) 4.- Node B. -> C(A,B,4) 5.- Node C. -> B(A,C,5)........

14 Split Horizont Method ABC D E 1 1 11

15 LINK-STATE ROUTING This is an alternative method of shortest path routing. Converges faster. Each node i periodically broadcasts the weights of all edges (i,j) incident on it (this is the link state) to all its neighbors

16 Link State Protocol

17 INTERVAL ROUTING Consider a connected network of N nodes. The conventional routing table used to route a message from one node to another has N − 1 entries, one for each destination node. Entry Destination# Port 13 Entries

18 Can we do something to reduce the growth of the routing tables? Entry Destination# Port ??????

19 Interval routing Santoro and Khatib first proposed interval routing for tree topologies only. Each node has two ports: port 0 is connected to the node with a higher id. port 1 is connected with the node of lower id

20 Interval Routing For a set of N nodes 0 ….N − 1, define the interval [p, q) between a pair of p and q as follows: if p < q then [p,q) = p, p + 1, p + 2,..., q − 2, q − 1 if p ≥ q then [p, q) = p, p + 1, p + 2,...,N − 1, 0, 1,..., q − 2, q − 1 As an example, if N = 8, then [5, 5) = 5, 6, 7, 0, 1, 2, 3, 4.

21 Routing for a tree Network 1. Label the root as node 0. 2. Do a preorder traversal of the tree, and label the successive nodes in ascending order starting from 1. 3. For each node, label the port towards a child by the node number of the child. Then label the port towards the parent by L(i) + T(i) + 1 mod N, where L(i) is the label of the node i T(i) is the number of nodes in the subtree under node i (excluding i) Subtree under i: L(i),L(i)+T(i) + 1 mod N) Comp: [L(i)+T(i)+1 mod N,L(i))

22 Adaptation to changes in the topology. Every time a new node is added to a network, or an existing node is removed from the network, in general all node labels and port labels have to be recomputed.

23 Prefix Routing if X = Y → Deliver the message locally X = Y → Find the port with the longest prefix of X as its label; Forward the message towards that port fi


Download ppt "10.- Graph Algorithms Centro de Investigación y Estudios Avanzados del Instituto Politécnico Nacional Introduction Routing Algorithms Computation of Shortest."

Similar presentations


Ads by Google