L: Algebraic Path Problems with applications to Internet Routing Lectures 7 and 8 Timothy G. Grifn timothy.grifn@cl.cam.ac.uk Computer Laboratory University of Cambridge, UK Michaelmas Term, 27 tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 7 and / 33 8 Recall our basic iterative algorithm A closer look... A xy I A xk`y AA xky I A xk`y pi, jq Ipi, jq à Api, uqa xky pu, jq u Ipi, jq à Api, uqa xky pu, jq pi,uqpe This is the basis of distributed Bellman-Ford algorithms (as in RIP and BGP) a node i computes routes to a destination j by applying its link weights to the routes learned from its immediate neighbors. It then makes these routes available to its neighbors and the process continues... tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 72 and / 33 8
What if we start iteration in an arbitrary state M? In a distributed environment the topology (captured here by A) can change and the state of the computation can start in an arbitrary state (with respect to a new A). Theorem For ď k, A xy M M A xk`y M AA xky M I A xky M If A is q-stable and q ă k, then Ak M A pk q A xky M Ak M A tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 73 and / 33 8 RIP-like example (see RFC 58) 2 3 2 3 Adjacency matrix A Adjacency matrix A 2 2 3 8 8 8 f f 2 8 3 8 8 2 3 8 8 8 8 f f 2 8 3 8 8 8 Using AddZerop8, pn, min, `qq but ignoring inl and inr tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 74 and / 33 8
RIP-like example counting to convergence (2) 2 3 2 3 The solution A The solution A 2 2 3 2 2 2 3 2 2 f f 2 3 2 3 f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 75 and / 33 8 RIP-like example counting to convergence (3) The scenario: we arrived at A, but then links tp, 3q, p3, qu fail. So we start iterating using the new matrix A 2. xky Let B K represent A 2 M, where M A. tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 76 and / 33 8
RIP-like example counting to convergence (4) B 2 3 2 2 2 3 2 2 f f B 3 2 3 4 4 2 4 3 f f B 2 3 2 3 2 2 3 f f B 4 2 3 5 5 2 5 3 f f B 2 2 3 3 3 2 3 3 f f B 5 2 3 6 6 2 6 3 f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 7 and / 33 8 RIP-like example counting to convergence (5) B 6 2 3 7 7 2 7 3 2 2 f f B 9 2 3 2 3 f f B 7 2 3 8 8 2 8 3 f f B 2 3 2 3 f f B 8 2 3 9 9 2 9 3 f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 78 and / 33 8
RIP-like example counting to innity () 2 3 2 3 The solution A The solution A 3 2 3 2 2 2 3 2 2 f f 2 3 8 8 2 8 3 8 8 8 f f xky Now let B K represent A 3 M, where M A. tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routingc 27 Lectures 79 and / 33 8 RIP-like example counting to innity (2) B B B 2 2 3 2 2 2 3 2 2 f f 2 3 2 3 2 2 3 8 8 8 2 3 3 3 2 3 3 8 8 8 f f f f.. B 376.. B 998... 2 3 377 377 2 377 3 8 8 8. 2 3 999 999 2 999 3 8 8 8. f f f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures 7 and / 33 8
RIP-like example What s going on? Recall A xky M pi, jq Ak Mpi, jq A pi, jq A (i, j) may be arrived at very quickly but A k Mpi, jq may be better until a very large value of k is reached (counting to convergence) or it may always be better (counting to innity). Solutions? RIP: 8 6 tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures 7 and / 33 8 Other solutions? The Border Gateway Protocol (BGP) BGP exchanges metrics and paths. It avoids counting to innity by throwing away routes that have a loop in the path. The plan... Starting from pn, min, `q we will attempt to construct a semiring (using our lexicographic operators) that has elements of the form pd, Xq, where d is a shortest-path metric and X is a set of paths. Then, by succsessive renements, we will arrive at a BGP-like solution. tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures2 7 and / 33 8
A useful construction: The Lifted Product Lifted product semigroup Assume ps, q is a semigroup. Let liftps, q pnp2 S q, ˆ q where Xˆ Y tx y x P X, y P Y u. t, 3, 7u ˆ` t, 3, 7u t2, 4, 6, 8, 2, 34u tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures3 7 and / 33 8 Some rules (remember 2 ď S ) ASpliftpS, qq ô ASpS, q IDpliftpS, qq ô IDpS, q pˆα tαuq ANpliftpS, qq ô TRUE pω tuq CMpliftpS, qq ô CMpS, q SLpliftpS, qq ô ILpS, q _IRpS, q _ pipps, q ^ S 2q IPpliftpS, qq ô SLppS, qq ILpliftpS, qq ô FALSE IRpliftpS, qq ô FALSE tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures4 7 and / 33 8
Turn the Crank... ô ô ô ô IPpliftpliftptt, f u, ^qq SLpliftptt, f u, ^q ILptt, f u, ^q _IRptt, f u, ^q _ pipptt, f u, ^q ^ tt, f u 2q FALSE _FALSE _ ptrue ^TRUEq TRUE Note This kind of calculation become more interesting as we introduce more complex constructors and consider more complex properties... tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures5 7 and / 33 8 Let s use lift to construct bi-semigroups... Union with lifted product Assume ps, q is a semigroup. Let union_liftps, q pp n psq, Y, ˆ q where Xˆ Y tx y x P X, y P Y u, and X, Y P P n psq, the set of nite subsets of S. tu is the if has idenity α, then tαu is the a non-empty sequence will be written as rs, s,, s k s when does it have an annihilator for Y? we really need some inference rules here... tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures6 7 and / 33 8
pathspeq over graph G pv, Eq pathspeq union_liftpe, q where is sequence concatenation. spwp For our graph G pv, Eq, we will build a shortest paths with paths semiring spwp AddZerop, pn, min, `q ˆ pathspeqq Given an arc pi, jq we will give it a weight of the form Api, jq inlpn, trpi, jqsuq for some n P N. However, for ease of reading we will write and so on. Api, jq pn, trpi, jqsuq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures7 7 and / 33 8 Recall : RIP-like counting to convergence 2 3 2 3 The solution A The solution A 2 2 3 2 3 2 f f 2 2 2 3 2 2 3 Imagine that we have augmented this example with paths. f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures8 7 and / 33 8
B Let B A be the solution for the (path augmented) matrix A : 2 3 p, tǫuq p, trp, qsuq p, trp, 2qsuq p2, trp, q, p, 3qsuq p, trp, qsuq p, tǫuq p, trp, 2qsuq p, trp, 3qsuq 2 p, trp2, qsuq p, trp2, qsuq p, tǫuq p2, trp2, q, p, 3qsuq 3 p2, trp3, q, p, qsuq p, trp3, qsuq p2, trp3, q, p, 2qsuq p, tǫuq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures9 7 and / 33 8 B Now, arcs p, 3q and p3, q vanish! With the new (path-augmented) matrix A 2, we start the iteration in the old state B. After one iteration we have B p, 3q p2, trp, q, p, 3qsuq B p, 3q p3, trp, q, p, q, p, 3qs, rp, 2q, p2, q, p, 3qsuq B p2, 3q p2, trp2, q, p, 3qsuq B p3, q p, trp3, 2q, p2, qsuq (stable!) B p3, q p, trp3, 2q, p2, qsuq (stable!) B p3, 2q p, trp3, 2qsuq (stable!) tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures2 7 and / 33 8
B 2 After another iteration we have B 2 p, 3q p3, trp, 2q, p2, q, p, 3qsuq B 2 p, 3q p3, trp, q, p, q, p, 3qs, rp, 2q, p2, q, p, 3qsuq B 2 p2, 3q p3, trp2, q, p, q, p, 3qsuq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures2 7 and / 33 8 B 3 After another iteration we have B 3 p, 3q p4, trp, q, p, q, p, q, p, 3qs, rp, q, p, 2q, p2, q, p, 3qs, rp, 2q, p2, q, p, q, p, 3qsuq B 3 p, 3q p4, trp, q, p, 2q, p2, q, p, 3qs, rp, 2q, p2, q, p, q, p, 3qsuq B 3 p2, 3q p4, trp2, q, p, 2q, p2, q, p, 3qs, rp2, q, p, q, p, q, p, 3qs, rp2, q, p, 2q, p2, q, p, 3qsuq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures22 7 and / 33 8
B Finally, the problem is resolved at the -th iteration: 2 3 p, tǫuq p, trp, qsuq p, trp, 2qsuq p, trp, 2q, p p, trp, qsuq p, tǫuq p, trp, 2qsuq p, trp, 2q, p 2 p, trp2, qsuq p, trp2, qsuq p, tǫuq p, trp2, 3 3 p, trp3, 2q, p2, qsuq p, trp3, 2q, p2, qsuq p, trp3, 2qsuq p, tǫuq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures23 7 and / 33 8 Recall RIP-like counting to innity 2 3 2 3 It should be clear that we have not yet reached our goal. This example will lead to sets of ever longer and longer paths and never terminate. How do we x this? tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures24 7 and / 33 8
Reductions If ps,, bq is a semiring and r is a function from S to S, then r is a reduction if for all a and b in S rpaq rprpaqq 2 rpa bq rprpaq bq rpa rpbqq 3 rpa b bq rprpaq b bq rpa b rpbqq Note that if either operation has an identity, then the rst axioms is not needed. For example, rpaq rpa q rprpaq q rprpaqq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures25 7 and / 33 8 Reduce operation If ps,, bq is semiring and r is a reduction, then let red r psq ps r, r, b r q where S r ts P S rpsq su 2 x r y rpx yq 3 x b r y rpx b yq Is the result always semiring? tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures26 7 and / 33 8
Elementary paths reduction Recall pathspeq pathspeq union_liftpe, q where is sequence concatenation. A path p is elementary if no node is repeated. Dene the reduction rpxq tp P X p is an elementary pathu Semiring of Elementary Paths epathspeq red r ppathspeqq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures27 7 and / 33 8 Starting in an arbitrary state? 2 3 2 3 tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures28 7 and / 33 8
Starting in an arbitrary state? No! using AddZerop8, pn, min, `q ˆ epathspeqq.. B 998... 2 3 p, tǫuq p, trp, qsuq p, trp, 2qsuq p999, tuq p, trp, qsuq p, tǫuq p, trp, 2qsuq p999, tuq 2 p, trp2, qsuq p, trp2, qsuq p, tǫuq p999, tuq 3 8 8 8 p, tǫuq. f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures29 7 and / 33 8 Solution: use another reduction! r pinrp8qq inrp8q " inrp8q if W tu rpinlqps, W q inlps, W q otherwise Now use this instead red r paddzerop8, pn, min, `q ˆ epathspeqqq tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures3 7 and / 33 8
Starting in an arbitrary state? B and B 2 3 p, tǫuq p, trp, qsuq p, trp, 2qsuq p2, trp, q, p, 3qsuq p, trp, qsuq p, tǫuq p, trp, 2qsuq p, trp, 3qsuq 2 p, trp2, qsuq p, trp2, qsuq p, tǫuq p2, trp2, q, p, 3qsuq 3 p2, trp3, q, p, qsuq p, trp3, qsuq p2, trp3, q, p, 2qsuq p, tǫuq 2 3 p, tǫuq p, trp, qsuq p, trp, 2qsuq p2, trp, q, p, 3qsuq p, trp, qsuq p, tǫuq p, trp, 2qsuq 8 2 p, trp2, qsuq p, trp2, qsuq p, tǫuq p2, trp2, q, p, 3qsuq 3 8 8 8 p, tǫuq f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures3 7 and / 33 8 Starting in an arbitrary state? B 2 and B 3 2 3 p, tǫuq p, trp, qsuq p, trp, 2qsuq p3, trp, 2q, p2, q, p, 3qsuq p, trp, qsuq p, tǫuq p, trp, 2qsuq 8 2 p, trp2, qsuq p, trp2, qsuq p, tǫuq p3, trp2, q, p, q, p, 3qsuq 3 8 8 8 p, tǫuq f f 2 3 p, tǫuq p, trp, qsuq p, trp, 2qsuq 8 p, trp, qsuq p, tǫuq p, trp, 2qsuq 8 2 p, trp2, qsuq p, trp2, qsuq p, tǫuq 8 3 8 8 8 p, tǫuq f f tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures32 7 and / 33 8
Homework 3 (due 6 November) Prove SLpliftpS, qq ô ILpS, q _IRpS, q _ pipps, q ^ S 2q Characterise exactly when union_liftps, q is a semiring. tgg22 (cl.cam.ac.uk) L: Algebraic Path Problems with applications to Internet T.G.Grifn Routing c 27 Lectures33 7 and / 33 8