Routing Chapter 4 Shortest path routing Gossip Iterative Construction of Routing Tables Shortest Path Spanning Tree All-pair Min-hop routing Coping with changes Point of Failure re-routing Compact Routing Paola Flocchini
Routing: Decision procedure deciding the path of messages through intermediary nodes. Router: Dedicated processor which automatically determines a route for messages going through it. The decision is taken according to a piece of information contained in the message (destination address) and local knowledge possessed by the router (specific routing table or algorithm.) Paola Flocchini
Each identity has a distinct identifier (global names.) Each link is labelled (and there is local orientation.) 2 5 4 1 1 4 2 2 1 1 3 1 2 4 3 2 6 5 3 3 2 Local orientation: un nodo puede distinguir entre sus vecinos Each entity has a routing function f(.). For all destinations y, f(y) returns the link on which to send a message to its destination y. ? dest = “y” ? x ? f(y) = link Paola Flocchini
number of bits necessary to hold the local routing function. Routing memory: number of bits necessary to hold the local routing function. Search time: time to choose the link to be used. Paola Flocchini
Routing Tables When a message arrives at a node, the router consults a local table and determines the message’s exit port. Node a b c ... u z Link 2 1 ... - 4 4 1 u 3 2 n entries n entradas -> logn bits para su representación binaria Binary search -> divide and conquer Complexity Routing memory: O(n log n) Search time: O(log n) (binary search) Paola Flocchini
Routing table Full routing table Dest h k c d e f Next link (s,h) (s,c) (s,e) The full routing table describes the whole graph at each node Routing table Asumimos: bidirectional links, conectivity, total reliability, IDs Dest h k c d e f Shortest path (s,h) (s,h)(h,k) (s,c) (s,c)(c,d) (s,e) (s,e)(e,f) Cost 1 4 10 12 5 8 f 5 3 h k 3 1 3 5 s e 10 8 2 d c Full routing table Paola Flocchini
Map_Gossip To construct ALL routing tables: input collection (gossip) Every entity broadcasts its initial information Map_Gossip 1. Create an arbitrary spanning tree 2. Each entity gets info about its own neighbours 3. Each entity broadcast the info along the tree Paola Flocchini
x deg(x) (n-1) = 2m (n-1) Message Complexity O(m+ n log n) Create an arbitrary spanning tree 2. Each entity gets info about its own neighbours 3. Each entity broadcast the info along the tree e.g., with Megamerger 2m just an exchange of info m links, n nodos x deg(x) (n-1) = 2m (n-1) 2 m n +O(m) =O(mn) With HUGE MESSAGES Paola Flocchini
Note: an entity must have enough space to store the full map of the network. Es decir: link state routing algorithms Paola Flocchini
Iterative construction of Routing Tables When an entity does not have enough space to store the map of the network. Initially an entity knows only its neighbours f Dest h k c d e f Shortest path (s,h) ? (s,c) (s,e) 5 3 h k 3 1 3 5 s e 10 8 2 d c Distance vector Paola Flocchini
At each iteration every entity sends its current distance vector to its neighbours Receiving a distance vector from the neighbours, an entity updates its own Paola Flocchini
s h c Dest h k c d e f Shortest path (s,h) 1 ? (s,c) 10 (s,e) 5 Dest s 3 h k 3 1 3 5 s e 10 8 2 d c Paola Flocchini
Initial Distance Vectors h k c d e f - 1 10 5 3 2 8 f 5 3 h k 3 1 3 5 s e 10 8 2 d c Paola Flocchini
Distance Vectors after 1st Iteration h k c d e f - 1 4 10 12 5 8 3 11 6 2 f 5 3 h k 3 1 3 5 s e 10 8 2 d c Paola Flocchini
Distance Vectors after 2nd Iteration h k c d e f - 1 4 10 12 5 8 3 11 13 6 2 f 5 3 h k 3 1 3 5 s e 10 8 2 d c Paola Flocchini
With at most n-1 iteration each node has the correct information Paola Flocchini
At each iteration each entity x sends the vector to |N(x)| neighbours Message Complexity At each iteration each entity x sends the vector to |N(x)| neighbours n items of info Messages per iteration = n x |N(x)| = 2 n m |N(x)| es deg(x) Total = 2 (n-1) n m Paola Flocchini
Map-gossip: a lot of local storage Iterative-construction: less local storage but more messages Is there something in between ? Paola Flocchini
Observation: the full routing table of a node x describes a Spanning tree (shortest path spanning tree for x PT(x)) Dest h k c d e f Shortest path (s,h) (s,h)(h,k) (s,c) (s,c)(c,d) (s,e) (s,e)(e,f) 3 5 2 1 10 s Full routing table Cost 4 12 8 Se llama también sink tree de x Paola Flocchini
To construct the routing table of x we just need to construct the shortest path spanning tree from x Paola Flocchini
Shortest Path Spanning Tree in Weighted Graphs - Dijkstra’s Algorithm (classical, serial) - Distributed Version (PT-Construction) Paola Flocchini
Dijkstra’s Algorithm for building the shortest path spanning tree The distance of a vertex v from a vertex s is the length of a shortest path between s and v Dijkstra’s algorithm computes the distances of all the vertices from a given start vertex s Assumptions: the graph is connected the edges are undirected the edge weights are nonnegative Paola Flocchini
Distributed Version PT-Construction Every node in the tree knows its cost (shortest path to the root) A 4 8 The root broadcasts in T the start of a new iteration (start message) 2 2 3 Ex. 7 1 B C D 3 9 2 5 E 8 F 2) Each entity in T computes locally the shortest distance from the root to its neighbours outside T (mycost+edge-cost) Ex. C B A E D F 3 2 4 8 7 1 5 9 11 Paola Flocchini
3) The overall minimum is computed at the 8 A 3) The overall minimum is computed at the root (minimum finding on T) (min message) and the corresponding link is chosen 5 8 9 C D 11 8 5 4) The root notifies the corresponding node of the selection (expansion message) “Join the tree, your cost is 5” C A D 8 11 E B 7 2 9 F 5 3 Paola Flocchini
4) The new node notifies its neighbours so that the internal links can be marked B C D E F “I am in the tree” And wait for the acknowledgement before sending a message to the root to notify the end of the iteration (notification message) A B C D “OK” Paola Flocchini “OK” E F
Complexity start, minimum, expansion, notification: ni: nodes in the tree at step i n-1 (4(ni -1) +2) = 2 n2 -4n + 2 i=1 O(n2) New link just added Paola Flocchini
Complexity Neighbour notification 2 |N(x)| = 2 deg(x) = 4 m = O(m) Final broadcast: n-1 Total: O(m + n2) = O(n2) x V x V COST FOR BUILDING JUST ONE ROUTING TABLE !!! Paola Flocchini
All-pairs Shortest Path Paola Flocchini
Algorithm Cost Restriction Map-gossip O(n m ) (m) local storage Iterative O(n2 m) PT-constr O(n3) Sparser-gossip O(n2 log n) Paola Flocchini
Min-Hop Routing Breadth First Spanning Tree Paola Flocchini
At step 1 the root chooses all nodes at distance 1 At step 2, it chooses all the nodes at distance 2 … At step i, it chooses the nodes at distance i Paola Flocchini
Breadth-First Spanning Tree Construction The root send “start iteration 1” A node receiving the message mark itself as a node at distance “1” , mark the sender as parent and sends back an ack. In general at step i, all nodes at distance i from the root are in the tree. Paola Flocchini
The Algorithm At iteration i+1: The root send “start iteration i+1” when the message reaches a node at distance i, it will send an attack to the neighbours (that are not at distance i-1) and will wait for a reply A node X will reply with a positive ack only if: this is the first attack (so X is not part of the tree yet) and X is not at distance i, otherwise it will reply with a negative ack. An acknowledgement “end-of-iteration i+1” travels up to the root and the root starts the new iteration Attack = explore Paola Flocchini
+ Notification end-of- iteration up ok ok no ok no no + Notification end-of-iteration up Paola Flocchini
+ Notification end-of-iteration up ok ok + Notification end-of-iteration up no Paola Flocchini no
Complexity Start and end-of iteration: ni: nodes in the tree at step i 1 i < r(root) (r(root) = eccentricity of the root) depends on the topology) [ ex. line, O(n2) ] Attack&Reply |N(x)| x V = deg(x) = 2 m = O(m) Total: 2m + 2(ni -1) 2m+ 2(n-1)d(G) O(m + n2)= O(n2) d(g) es el diámetro, y coincide con el número de iteraciones de BF Paola Flocchini
Multiple Layers Paola Flocchini
Compact Routing Basic Idea: Use tricks in node and edge labels to decrease routing memory. 123 dest = 2000 ? 17 4 Paola Flocchini
Compact Routing - An idea... dest 1 2 3 4 5 6 7 8 9 link 2 - 3 1 4 1 4 3 2 3 n entries link 1 2 3 4 interval [6, 7) [1, 3) [4, 6) [7,1) d (degree) entries Paola Flocchini
Interval Routing Destination addresses with the same exit are grouped in intervals. A router finds the direction on which to transmit the message by determining the interval containing the address of the message’s destination. Idea: Vertex labelling: in 0, ..., n-1 Edge labelling: (cyclic) intervals (cyclic: [a, b) = [a, n) [0, b) if a b)) [1, 8) (message, dest) “5 [8, 11) [11, ...) Choose the arc labelled by [a, b) such that dest [a, b) Paola Flocchini
Complexity Memory: d * 2 * log n bits Time: log d (binary search) [1, 8) [8, 11) [11, 1) Memory: d * 2 * log n bits Time: log d (binary search) Memory Time Routing tables O(n log n) O(log n) Interval O(d log n) O(log d) Paola Flocchini
Interval Routing in Trees Choose an arbitrary root v0 (Tv = subtree with root v nv = dimension of Tv (ex. nv0 = n)) Labelling of vertices: preoder (l(v) = label of v) Labelling of arcs: cyclic intervals (l(v,u) = label of (v, u)) [2,8) 1 [12,1) [8,12) 2 [3,7) 12 8 [7,3) 3 7 [4,5) 13 9 10 4 5 6 11 There is only one path between each pair of entities. l(v,u) = [l(u), l(u + nu)) Paola Flocchini
i [a,b) [c,i) [b,c) Paola Flocchini
In Arbitrary Networks First phase (vertex labelling) Begin with an arbitrary vertex v. Build the BFS spanning tree T of G with root v. Traverse T depth-first (preorder) labeling vertices accordingly. 1 2 7 4 8 3 6 5 Paola Flocchini
More... Second (edge labelling) 1 2 7 3 6 4 8 3 6 5 Paola Flocchini
More... Theorem: x, y V, the distance between x and y in the spanning tree is 2DG, where DG is the diameter of G. Proof: ROOT R Y X dT(x, y) dT(x, R) + dT(R, y) = dT(x, R) + dT(y, R) = dG(x, R) + dG(y, R) DG + DG = 2DG Paola Flocchini
Interval routing in the ring [1, 4) [6, 2) 7 1 2 [5, 1) [2, 5) [4, 7) [3, 6) [7, 3) 3 [4, 7) [7, 3) [3, 6) [5, 1) [1, 4) 6 5 4 [6, 2) [2, 5) WITH INTERVAL COMPLETE TABLE 1 2 3 4 5 6 7 left right - left right [6, 2) [2, 5) i [i + n/2 + 1), i) [i+1, i + n/2) Paola Flocchini
In the mesh [1, 2] 1 2 [3, 8] [0, 2] [0, 2] [4, 5] [3] [5] 3 4 5 1 2 [3, 8] [0, 2] [0, 2] [4, 5] [3] [5] 3 4 5 [6, 8] [6, 8] 6 7 8 Paola Flocchini
Classical Routing in the mesh (with a compass) 00 01 02 10 11 12 20 21 22 From (a,b) to (c,d): let i = a-c and j =b-d If i <0 take -i times WEST, otherwise take i times EAST If j <0 take -i times NORTH, otherwise take j times SOUTH Paola Flocchini
In the Hypercube [7,0] 7 6 [4,5] [1,3] 4 5 [4, 6] [7,0] 1 [5, 7] 1 [5, 7] [2, 3] 3 2 [0, 1] [3, 4] Label the nodes according to a particular hamiltonian cycle ... Paola Flocchini
Classical routing in the Hypercube From source to dest: follow the path given by the dimensions in which the two source and dest differ. 001 101 110 111 000 001 010 011 EX: 010 to 100 dim 2 and dim 3 Paola Flocchini
Boolean Routing Idea: Labelling of vertices: boolean values. Arc labeling: boolean predicates. Destination addresses with the same exit port satisfy the same condition (boolean predicates.) A router finds the direction on which to transmit a message by determining the boolean predicate which is true on the message destination. a b (message, dest) “101” a c b c Choose the arc labelled by P such that P(dest) is true. Paola Flocchini
Boolean Routing - Example... 01 10 11 00 *0 1* *1 0* destinations starting with bit 0 0* 1* 10 destinations starting with bit 1 Paola Flocchini
Prefix Routing Destination addresses with the same exit port have the longest common prefix. A router finds the direction on which to transmit a message by determining the arc with the longest prefix that is common with the destination. Vertex labelling: Strings on an alphabet . Arc labelling: Strings on an alphabet . 111 (message, dest) “101” 1001 ???..! 01 Choose the arc labelled by s such that s is the prefix of maximal length of dest . Paola Flocchini
Prefix Routing - More... a b a b aa ab ba aa ab ba aaa aab 1001 101 10101 1 100 Paola Flocchini