1 / 23

10.- Graph Algorithms

Sistemas Distribuidos. 10.- Graph Algorithms. Introduction Routing Algorithms Computation of Shortest Path Distance Vector Routing Link-State Routing Interval Routing. Centro de Investigación y Estudios Avanzados del Instituto Politécnico Nacional. Graph. Graph G : G = (V, E)

calais
Download Presentation

10.- Graph Algorithms

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. Sistemas Distribuidos 10.- GraphAlgorithms Introduction Routing Algorithms Computation of Shortest Path Distance Vector Routing Link-State Routing Interval Routing Jorge Antonio Perez Espinoza Centro de Investigación y Estudios Avanzados del Instituto Politécnico Nacional

  2. Graph Graph G: G = (V, E) V = Set of nodes 0….N-1. E= Set of edges representing links: (A,B),(A,C) • Eachedge w(i, j) has a weight. B A 2 4 1 1 E C 5 3 D

  3. Graphs on DistributedSystem • 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. B A 2 4 1 1 E C 5 3 D

  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. • Eachedge w(i, j) has a weight. The topology is static. B A 2 4 1 1 E C 1 3 D

  6. Chandy and Misra Algorithm N0 N4 • 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) = ∞. 6 2 3 N2 N5 4 N1 1 5 N4 3

  7. For each node: N0 N4 • 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. 6 2 3 N2 N5 4 N1 1 5 N4 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 N0 N4 6 2 3 N2 N5 4 {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 < D if parent ≠ k or i -> 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 N1 1 5 N4 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 : Theshortestpathfrom 0 toiisviaj , wherej ≠k. Message D(i)>D(j)+w(j,i). MessageD(i)>D(k)+w(k,i). 1 0 K 1 i 2 2 j

  11. DISTANCE VECTOR ROUTING Shortest path routing, but handles topology changes. 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 Each node j periodically broadcasts its distance vector to its immediate neighbors ∀k ≠ i :D[i,k]=minj(w[i,j]+D[j,k])

  12. DISTANCE VECTOR ROUTING Following this, the distance vectors are corrected, and routing table is eventually recomputed.

  13. Count to Infinity Problem A B C E D 1 1 1 1 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 A B C E D 1 1 1 1

  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. 13 Entries

  18. Can we do something to reduce the growth ofthe routing tables? ??????

  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 Subtree under i: L(i),L(i)+T(i) + 1 mod N) Comp: [L(i)+T(i)+1 mod N,L(i)) • 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)

  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

More Related