An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring...

60
An Albebraic Approach to Internet Routing Lectures 04 — 08 Timothy G. Griffin [email protected] Computer Laboratory University of Cambridge, UK Michaelmas Term 2009 T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08 T.G.Griffin c 2009 1 / 60

Transcript of An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring...

Page 1: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

An Albebraic Approach to Internet RoutingLectures 04 — 08

Timothy G. Griffin

[email protected] Laboratory

University of Cambridge, UK

Michaelmas Term2009

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 1 / 60

Page 2: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Outline

1 Lecture 04: Semiring Examples

2 Lecture 05: More Semiring constructions

3 Lecture 06: Beyond Semirings

4 Lecture 07: Advanced Constructions I

5 Lecture 08: Routing without distribution?

6 Bibliography

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 2 / 60

Page 3: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Lexicographic Semiring, example continued

sp ~× bw

Let (S, ⊕, ⊗, 0, 1) = sp ~× bw.

sp = (N∞, min, +, ∞, 0)bw = (N∞, max, min, 0, ∞)

sp ~× bw = (N∞ × N∞, min ~×max, +×min, (∞, 0), (0, ∞))

(17, 10)⊕ (21,100) = (17, 10)(17, 10)⊕ (17,100) = (17, 100)(17, 10)⊗ (21,100) = (38, 10)(17, 10)⊗ (17,100) = (34, 10)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 3 / 60

Page 4: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Sample instance for sp ~× bw

1

2

3

4

5

(6, 70)

(5, 70) (6, 20)(2, 50)

(8, 90)

(1, 50)

(1, 10)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 4 / 60

Page 5: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

The adjacency matrix

1 2 3 4 5

1 (∞, 0) (2, 50) (8, 90) (6, 70) (∞, 0)2 (2, 50) (∞, 0) (5, 70) (∞, 0) (6, 20)3 (8, 90) (5, 70) (∞, 0) (1, 50) (1, 10)4 (6, 70) (∞, 0) (1, 50) (∞, 0) (∞, 0)5 (∞, 0) (6, 20) (1, 10) (∞, 0) (∞, 0)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 5 / 60

Page 6: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Shortest-path DAG rooted at 1

1

2

3

4

5(8, 90) (1, 10)

(6, 20)

(1, 50)

(5, 70)

(6, 70)

(2, 50)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 6 / 60

Page 7: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Shortest-path DAG rooted at 3

1

2

3

4

5

(6, 20)

(8, 90) (1, 10)

(1, 50)

(5, 70)

(6, 70)

(2, 50)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 7 / 60

Page 8: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Shortest-path DAG rooted at 5

1

2

3

4

5

(6, 70)

(8, 90)

(5, 70) (6, 20)(2, 50)

(1, 10)

(1, 50)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 8 / 60

Page 9: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

The routing matrix

1 2 3 4 5

1 (0, ∞) (2, 50) (7, 50) (6, 70) (8, 20)2 (2, 50) (0, ∞) (5, 70) (6, 50) (6, 20)3 (7, 50) (5, 70) (0, ∞) (1, 50) (1, 10)4 (6, 70) (6, 50) (1, 50) (0, ∞) (2, 10)5 (8, 20) (6, 20) (1, 10) (2, 10) (0, ∞)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 9 / 60

Page 10: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

A Strange Lexicographic Semiring

sp ~× oneforall

Let (S, ⊕, ⊗, 0, 1) = sp ~× oneforall.

sp = (N∞, min, +, ∞, 0)

oneforall = (2{a, b, c}, ∪, ∩, {}, {a, b, c})sp ~× oneforall = (N∞ × 2{a, b, c}, min ~×∪, +× ∩, (∞, {}), (0, {a, b, c}))

(17, {a})⊕ (21, {b}) = (17, {a})(17, {a})⊕ (17, {b}) = (17, {a, b})(17, {a})⊗ (21, {b}) = (38, {})(17, {a})⊗ (17, {b}) = (34, {})

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 10 / 60

Page 11: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Sample instance for sp ~× oneforall

1

2

3

4

5

(6 {a b})

(5 {a b c}) (6 {c})(2 {a})

(8 {b c})

(1 {b})

(1 {b})

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 11 / 60

Page 12: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

The adjacency matrix

1 2 3 4 5

1 (∞, {}) (2, {a}) (8, {b, c}) (6, {a, b}) (∞, {})2 (2, {a}) (∞, {}) (5, {a, b, c}) (∞, {}) (6, {c})3 (8, {b, c}) (5, {a, b, c}) (∞, {}) (1, {b}) (1, {b})4 (6, {a, b}) (∞, {}) (1, {b}) (∞, {}) (∞, {})5 (∞, {}) (6, {c}) (1, {b}) (∞, {}) (∞, {})

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 12 / 60

Page 13: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Sample instance for sp ~× oneforall

1

2

3

4

5(8 {b c})

(6 {c})

(1 {b})

(5 {a b c})

(1 {b})(6 {a b})

(2 {a})

Shotest paths — for the first component only — rooted at node 1

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 13 / 60

Page 14: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

The routing matrix

If R(i , j) = (v , S) and x ∈ S, then there is at least one path of weightv from i to j with x in every arc weight along the path.

1 2 3 4 5

1 (0, {a b c}) (2, {a}) (7, {a, b}) (6, {a, b}) (8, {b})2 (2, {a}) (0, {a b c}) (5, ?) (6, ?) (6, ?)3 (7, {a, b}) (5, ?) (0, {a b c}) (1, ?) (1, ?)4 (6, {a, b}) (6, ?) (1, ?) (0, {a b c}) (2, ?)5 (8, {b}) (6, ?) (1, ?) (2, ?) (0, {a b c})

Please fill in the “?”...

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 14 / 60

Page 15: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Outline

1 Lecture 04: Semiring Examples

2 Lecture 05: More Semiring constructions

3 Lecture 06: Beyond Semirings

4 Lecture 07: Advanced Constructions I

5 Lecture 08: Routing without distribution?

6 Bibliography

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 15 / 60

Page 16: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Challenge

Construct a semiring path so that if R(i , j) = (v , W ), then W is a set ofall paths from i to j with weight v .

The Free Monoid over (the set) Σ

free(Σ) = (Σ∗, ·, ε)

whereΣ∗ is the set of all finite sequences over Σ,· is concatenation,ε is the empty sequence.

Given the graph G = (V , E), we might consider using free(E) torepresent paths.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 16 / 60

Page 17: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

A general construction

(S⊗, 1) a monoid.uniontimes(S, ⊗, 1) = (2S, ∪, ⊗×, {}, {1}), where

A⊗× B = {a⊗ b | a ∈ A, b ∈ B}.

Claimuniontimes(S, ⊗, 1) is a semiring

Will this work?paths = uniontimes(free(E))

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 17 / 60

Page 18: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Sample instance for path

1

2

3

4

5{(1 3)}

{(3 1)}

{(1 2)}

{(2 1)}

{(1 4)}

{(4 1)}{(3 4)}{(4 3)}

{(3 2)}{(2 3)}{(5 2)}

{(2 5)}

{(3 5)}

{(5 3)}

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 18 / 60

Page 19: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

But is there a problem?

paths is not q-stable, for any q

R(1, 5) = {(1,2)(2,5),(1,3)(3,5),(1,3)(3,1)(13)(3,5),(1,3)(3,1)(13)(3,5)(5,3)(3,2)(2,5),· · ·}

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 19 / 60

Page 20: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

But what about sp ~× paths?

sp = (N∞, min, +, ∞, 0)paths = (2E∗ , ∪, ·×, {}, {ε})

sp ~× paths = (N∞ × 2E∗ , min ~×∪, +× ·×, (∞, {}), (0, {ε}))

(17, {(1,2)(2,3)})⊕ (17, {(1,3)}) = (17, {(1,2)(2,3)})(17, {(1,2)(2,3)})⊕ (17, {(1,3)}) = (17, {(1,2)(2,3), (1,3)})

(17, {(1,2)(2,3)})⊗ (21, {(3,4), (3,5)}) = (38, {(1,2)(2,3)(3,4), (1,2)(2,3)(3,5)})(17, 10)⊗ (17,100) = (34, {(1,2)(2,3)(3,4), (1,2)(2,3)(3,5)})

Show that this “works”. What is going on? (on Exercises II list)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 20 / 60

Page 21: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Outline

1 Lecture 04: Semiring Examples

2 Lecture 05: More Semiring constructions

3 Lecture 06: Beyond Semirings

4 Lecture 07: Advanced Constructions I

5 Lecture 08: Routing without distribution?

6 Bibliography

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 21 / 60

Page 22: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Path Weight with functions on arcs?

For graph G = (V , E), and path p = i1, i2, i3, · · · , ik .

Semiring Path WeightWeight function w : E → S

w(p) = w(i1, i2)⊗ w(i2, i3)⊗ · · · ⊗ w(ik−1, ik ).

How about functions on arcs?Weight function w : E → (S → S)

w(p) = w(i1, i2)(w(i2, i3)(· · ·w(ik−1, ik )(a) · · · )),

where a is some value originated by node ik

How can we make this work?

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 22 / 60

Page 23: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Algebra of Monoid Endomorphisms ([GM08])

A homomorphism is a function that preserves structure. Anendomprhism is a homomorphism mapping a structure to itself.

Let (S, ⊕, 0) be a commutative monoid.

(S, ⊕, F ⊆ S → S, 0, i , ω) is a algebra of monoid endomorphisms(AME) if

∀f ∈ F ∀b, c ∈ S : f (b ⊕ c) = f (b)⊕ f (c)

∀f ∈ F : f (0) = 0∃i ∈ F ∀a ∈ S : i(a) = a∃ω ∈ F ∀a ∈ S : ω(a) = 0

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 23 / 60

Page 24: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Solving (some) equations over a AMEsWe will be interested in solving for x equations of the form

x = f (x)⊕ b

Letf 0 = i

f k+1 = f ◦ f k

and

f (k)(b) = f 0(b) ⊕ f 1(b) ⊕ f 2(b) ⊕ · · · ⊕ f k (b)

f (∗)(b) = f 0(b) ⊕ f 1(b) ⊕ f 2(b) ⊕ · · · ⊕ f k (b)⊕ · · ·

Definition (q stability)

If there exists a q such that for all b f (q)(b) = f (q+1)(b), then f isq-stable. Therefore, f (∗)(b) = f (q)(b).

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 24 / 60

Page 25: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Key result (again)

LemmaIf f is q-stable, then x = f (∗)(b) solves the AME equation

x = f (x) ⊕ b.

Proof: Substitute f (∗)(b) for x to obtain

f (f (∗)(b)) ⊕ b= f (f (q)(b)) ⊕ b= f (f 0(b) ⊕ f 1(b) ⊕ f 2(b) ⊕ · · · ⊕ f q(b)) ⊕ b= f 1(b) ⊕ f 1(b) ⊕ f 2(b) ⊕ · · · ⊕ f q+1(b) ⊕ b= f 0(b)⊕ f 1(b) ⊕ f 1(b) ⊕ f 2(b) ⊕ · · · ⊕ f q+1(b)

= f (q+1)(b)

= f (q)(b)

= f (∗)(b)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 25 / 60

Page 26: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

AME of Matrices

Given an AME S = (S, ⊕, F ), define the semiring of n × n-matricesover S,

Mn(S) = (Mn(S), �, G),

where for A,B ∈Mn(S) we have

(A� B)(i , j) = A(i , j)⊕ B(i , j).

Elements of the set G are represented by n× n matrices of functions inF . That is, each function in G is represented by a matrix A withA(i , j) ∈ F . If B ∈Mn(S) then define A(B) so that

(A(B))(i , j) =⊕∑

1≤q≤n

A(i , q)(B(q, j)).

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 26 / 60

Page 27: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Here we go again...

Path WeightFor graph G = (V , E) with w : E → FThe weight of a path p = i1, i2, i3, · · · , ik is then calculated as

w(p) = w(i1, i2)(w(i2, i3)(· · ·w(ik−1, ik )(ω⊕) · · · )).

adjacency matrix

A(i , j) =

{w(i , j) if (i , j) ∈ E ,ω otherwise

We want to solve equations like these

X = A(X)� B

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 27 / 60

Page 28: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

So why do we need Monoid Endomorphisms??

Monoid Endomorphisms can be viewed as semiringsSuppose (S, ⊕, F ) is a monoid of endomorphisms. We can turn it intoa semiring

(F , ⊕, ◦)

where (f ⊕ g)(a) = f (a)⊕ g(a)

Functions are hard to work with....All algorithms need to check equality over elements of semiring,f = g means ∀a ∈ S : f (a) = g(a),S can be very large, or infinite.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 28 / 60

Page 29: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Lexicographic product of AMEs

(S, ⊕S, F ) ~× (T , ⊕T , G) = (S × T , ⊕S ~×⊕T , F ×G)

Theorem ([Sai70, GG07, Gur08])

M(S ~× T ) ⇐⇒ M(S) ∧ M(T ) ∧ (C(S) ∨ K(T ))

WhereProperty DefinitionM ∀a,b, f : f (a⊕ b) = f (a)⊕ f (b)C ∀a,b, f : f (a) = f (b) =⇒ a = bK ∀a,b, f : f (a) = f (b)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 29 / 60

Page 30: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Functional Union of AMEs

(S, ⊕, F ) +m (S, ⊕, G) = (S, ⊕, F + G)

Fact

M(S +m T ) ⇐⇒ M(S) ∧ M(T )

WhereProperty DefinitionM ∀a,b, f : f (a⊕ b) = f (a)⊕ f (b)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 30 / 60

Page 31: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Left and Rightright

right(S,⊕,F ) = (S,⊕, {i})

left

left(S,⊕,F ) = (S,⊕,K (S))

where K (S) represents all constant functions over S. For a ∈ S, definethe function κa(b) = a. Then K (S) = {κa | a ∈ S}.

FactsThe following are always true.

M(right(S))M(left(S)) (assuming ⊕ is idempotent)C(right(S))K(left(S))

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 31 / 60

Page 32: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Scoped Product

SΘT = (S ~× left(T )) +m (right(S) ~× T )

Theorem

M(SΘT ) ⇐⇒ M(S) ∧ M(T ).

Proof.

M(SΘT )

M((S ~× left(T )) +m (right(S) ~× T ))

⇐⇒ M(S ~× left(T )) ∧ M(right(S) ~× T )

⇐⇒ M(S) ∧ M(left(T )) ∧ (C(S) ∨ K(left(T )))

∧ M(right(S)) ∧ M(T ) ∧ (C(right(S)) ∨ K(T ))

⇐⇒ M(S) ∧ M(T )

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 32 / 60

Page 33: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Delta Product (OSPF-like?)

S∆T = (S ~× T ) +m (right(S) ~× T )

Theorem

M(S∆T ) ⇐⇒ M(S) ∧ M(T ) ∧ (C(S) ∨ K(T )).

Proof.

M(SΘT )

M((S ~× T ) +m (right(S) ~× T ))

⇐⇒ M(S ~× T ) ∧ M(right(S) ~× T )

⇐⇒ M(S) ∧ M(left(T )) ∧ (C(S) ∨ K(T ))

∧ M(right(S)) ∧ M(T ) ∧ (C(right(S)) ∨ K(T ))

⇐⇒ M(S) ∧ M(T ) ∧ (C(S) ∨ K(T ))

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 33 / 60

Page 34: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

How do we represent functions?

Definition (transforms (indexed functions))A set of transforms (S, L, B) is made up of non-empty sets S and L,and a function

B ∈ L→ (S → S).

We normally write l B s rather than B(l)(s). We can think of l ∈ L asthe index for a function fl(s) = l B s, so (S, L, B) represents the set offunction F = {fl | l ∈ L}.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 34 / 60

Page 35: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Examples

Example 1: TrivialLet (S, ⊗) be a semigroup.

transform(S, ⊕) = (S, S, B⊗),

where aB⊗ b = a⊗ b

Example 2: RestrictionFor T ⊂ S,

Restrict(T , (S, ⊕)) = (S, T , B⊗),

where aB⊗ b = a⊗ b

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 35 / 60

Page 36: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Example 3 : mildly abstract description of BGP’sASPATHs

Let apaths(X ) = (E(Σ∗) ∪ {∞}, Σ× Σ, B) where

E(Σ∗) = finite, elementary sequences over Σ (no repeats)(m, n) B ∞ = ∞

(m, n) B l =

{n · l (if m 6∈ n · l)∞ (otherwise)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 36 / 60

Page 37: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Exercises II

1 Complete the routing matrix for the instance of sp ~× oneforall inLecture 04.

2 Try to explain why our instance of sp ~× paths (Lecture 05) has afinite routing matrix. Is the semiring 0-stable?

3 Prove that uniontimes(S, ⊗, 1) is a semiring.4 Show that (F , ⊕, ◦) — from Lecture 06 — is a semiring.5 Construct two interesting instances of the scoped product

(Lecture 07!), each with adjacency and routing matrix.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 37 / 60

Page 38: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Outline

1 Lecture 04: Semiring Examples

2 Lecture 05: More Semiring constructions

3 Lecture 06: Beyond Semirings

4 Lecture 07: Advanced Constructions I

5 Lecture 08: Routing without distribution?

6 Bibliography

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 38 / 60

Page 39: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Minimal Sets (finite anti-chains)

min≤(A)

Suppose that (S, ≤) is a pre-ordered set. Let A ⊆ S be finite. Define

min≤(A) ≡ {a ∈ A | ∀b ∈ A : ¬(b < a)}

Example 1

(S, ≤) = (2{a, b, c}, ⊆)min⊆({{a, b, c}, {a}}) = {{a}}

min⊆({{a, b, c}, {a}, {a, b}, {b, c}}) = {{a}, {b, c}}

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 39 / 60

Page 40: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Example 2

(S, ≤) = (V ∗, ≤)V ∗ = finite sequences of nodes from V

p ≤ q ⇐⇒ | p |≤| q |min≤({(1, 3, 17), (4, 5)}) = {(4, 5)}

min≤({(1, 3, 17), (4, 5), (7, 8)}) = {(4, 5), (7, 8)}

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 40 / 60

Page 41: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Minimal Sets (continued)

Suppose that (S, ≤) is a pre-ordered set.

Pmin(S, ≤) ≡ {A ⊆ S | A is finite and min≤(A) = A}

The minset semigroup construction

minset(S, ≤) = (P≤min(S), ⊕≤min)

is the semigroup where

A ⊕≤min B ≡ min≤(A ∪ B).

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 41 / 60

Page 42: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Martelli’s semiring ([Mar74, Mar76])A cut set C ⊆ E for nodes i and j is a set of edges such there isno path from i to j in the graph (V , E − C).C is minimal if no proper subset of C is a cut set.Martelli’s semiring is such that A(∗)(i , j) is the set of all minimalcut sets for i and j .The arc (i , j) is has weight w(i , j) = {{(i , j)}}.S is the set of all subsets of the power set of E .X ⊕ Y is {x ∪ y | x ∈ X , y ∈ Y} with any non-minimal setsremoved.X ⊗ Y is X ∪ Y with any non-minimal sets removed.

Example

X = {{(2, 3}, {(1, 3), (2, 4)}}Y = {{(1, 3), (2, 3}, {(1, 3), (2, 4)}}

X ⊕ Y = {{(1, 3), (2, 3}, {(1, 3), (2, 4)}}X ⊗ Y = {{(2, 3}, {(1, 3), (2, 4)}}

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 42 / 60

Page 43: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Martelli

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 43 / 60

Page 44: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Martelli

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 44 / 60

Page 45: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Martelli

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 45 / 60

Page 46: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

More minset constructions (many details omitted ...)

For semiringsSuppose that T = (S, ⊕, ⊗) is a semiring.

minsetL(T ) ≡ (P≤L

min(S), ⊕≤L

min, ⊗≤L

min)

minsetR(T ) ≡ (P≤R

min(S), ⊕≤R

min, ⊗≤R

min)

where a ≤L b ⇐⇒ a = a⊕ b, a ≤R b ⇐⇒ b = a⊕ b, andA⊗≤min B = min≤{a⊗ b | a ∈ A, b ∈ B}.

For ordered semigroupsSuppose that T = (S, ≤, ⊗) is a semiring.

minset(T ) ≡ (P≤min(S), ⊕≤min, ⊗≤min)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 46 / 60

Page 47: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Yet another minset constructions (many details omitted...)

For “routing algebras”Suppose that T = (S, L, ≤, B ∈ (L× S)→ S) a routing algebra in thestyle of Sobrinho [Sob03, Sob05]. Then

minset(T ) ≡ (P≤min(S), L, ⊕≤min, B≤min)

where λB≤min A = min≤{λB | a ∈ A}

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 47 / 60

Page 48: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Martelli’s semiring expressed in a small language?

[NGG09]

martelli = swap(minset(sg2osr(2E , ∪)))

whereswap(S, ⊕, ⊗) = (S, ⊗, ⊕)

sg2osr(S, ⊕) = (S, ≤r⊕, ⊕)

minset(S, ≤, ⊗) = (P≤min(S), ⊕≤min, ⊗≤min)

minset(S, ≤) = (P≤min(S), ⊕≤min)

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 48 / 60

Page 49: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Outline

1 Lecture 04: Semiring Examples

2 Lecture 05: More Semiring constructions

3 Lecture 06: Beyond Semirings

4 Lecture 07: Advanced Constructions I

5 Lecture 08: Routing without distribution?

6 Bibliography

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 49 / 60

Page 50: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Local Optimality

Say that R is a locally optimal solution when

R = (A⊗ R)⊕ I.

That is, for i 6= j we have

R(i , j) =⊕q∈V

A(i , q)⊗ R(q, j) =⊕

q∈N(i)

w(i , q)⊗ R(q, j),

where N(i) = {q | (i , q) ∈ E} is the set of neighbors of i .

In other words, R(i , j) is the best possible value given the valuesR(q, j), for all neighbors q of i .

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 50 / 60

Page 51: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

With Distributivity

A is an adjacency matrix over semiring S.

For Semirings, the following two problems are essentially the same —locally optimal solutions are globally optimal solutions.

Global Optimality Local OptimalityFind R such that Find R such that

R(i , j) =⊕∑

p∈P(i, j)

w(p) R = (A⊗ R)⊕ I

Prove this!

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 51 / 60

Page 52: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Without DistributivityWhen ⊗ does not distribute over ⊕, the following two problems aredistinct.

Global Optimality Local OptimalityFind R such that Find R such that

R(i , j) =⊕∑

p∈P(i, j)

w(p) R = (A⊗ R)⊕ I

Global OptimalityThis has been studied, for example [LT91b, LT91a] in the context ofcircuit layout. I do not know of any application of this problem tonetwork routing. (Yet!)

Local OptimalityAt a very high level, this is the type of problem that BGP attempts tosolve!!

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 52 / 60

Page 53: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Example of local optima for bw ~× sp

1

2

3 4(1, 1)

(10, 5)(10, 5)

(1, 1)

Node 1 would prefer the path1→ 3→ 4 with weight (1, 2).But it is stuck with the best itcan get: the path1→ 3→ 2→ 4, with weight(1, 11).

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 53 / 60

Page 54: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

What are the conditions needed to guaranteeexistence of local optima?

For a non-distributed structure S = (S, ⊕, ⊗), can be used to findlocal optima when the following property holds.

Increasing

I : ∀a, b ∈ S : a 6= 0 =⇒ a < b ⊗ a

where a ≤ b means a = a⊕ b.

Non-decreasingIn order to derive I we often need the non-decreasing property:

ND : ∀a, b ∈ S : a ≤ b ⊗ a

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 54 / 60

Page 55: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Finding local optima with the iterative method

A[0](B) = BA[k+1](B) = (A⊗ A[k ](B))⊕ B

Think of the iterative version as a very abstract implementation of“vectoring”....

When distributivity holds we have A(k) ⊗ B = A[k ](B).

ClaimWhen S is increasing and ⊕ is selective and idempotent, then A[k ](B)converges to a locally optimal solution.

For various flavors of proof see [GG08, kCGG06, Sob03, Sob05].OPEN PROBLEM : no bounds are yet known!

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 55 / 60

Page 56: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Outline

1 Lecture 04: Semiring Examples

2 Lecture 05: More Semiring constructions

3 Lecture 06: Beyond Semirings

4 Lecture 07: Advanced Constructions I

5 Lecture 08: Routing without distribution?

6 Bibliography

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 56 / 60

Page 57: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Bibliography I

[GG07] A. J. T. Gurney and T. G. Griffin.Lexicographic products in metarouting.In Proc. Inter. Conf. on Network Protocols, October 2007.

[GG08] T. G. Griffin and A. J. T. Gurney.Increasing bisemigroups and algebraic routing.In 10th International Conference on Relational Methods inComputer Science (RelMiCS10), April 2008.

[GM08] M. Gondran and M. Minoux.Graphs, Dioids, and Semirings : New Models andAlgorithms.Springer, 2008.

[Gur08] Alexander Gurney.Designing routing algebras with meta-languages.Thesis in progress, 2008.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 57 / 60

Page 58: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Bibliography II

[kCGG06] Chi kin Chau, Richard Gibbens, and Timothy G.Griffin.Towards a unified theory of policy-based routing.In Proc. IEEE INFOCOM, April 2006.

[LT91a] T. Lengauer and D. Theune.Efficient algorithms for path problems with general costcriteria.Lecture Notes in Computer Science, 510:314–326, 1991.

[LT91b] T. Lengauer and D. Theune.Unstructured path problems and the making of semirings.Lecture Notes in Computer Science, 519:189–200, 1991.

[Mar74] Alberto Martelli.An application of regular algebra to the enumeration of cutsets in a graph.In Information and Processing 74, 1974.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 58 / 60

Page 59: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Bibliography III

[Mar76] Alberto Martelli.A gaussian elimination algorithm for the enumeration of cutsets in a graph.Journal of the ACM, 23(1):58–73, 1976.

[MS03] J. Monnot and O. Spanjaard.Bottleneck shortest paths on a partially ordered scale.4OR, ??(??):225–241, 2003.

[NGG09] V. Naudžiunas, A. J. T. Gurney, and T. G. Griffin.Small languages for optimization semirings, 2009.Work in progress.

[Sai70] Tôru Saitô.Note on the lexicographic product of ordered semigroups.Proceedings of the Japan Academy, 46(5):413–416, 1970.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 59 / 60

Page 60: An Albebraic Approach to Internet Routing Lectures 04 --- 08 · Outline 1 Lecture 04: Semiring Examples 2 Lecture 05: More Semiring constructions 3 Lecture 06: Beyond Semirings 4

Bibliography IV

[Sob03] Joao Luis Sobrinho.Network routing with path vector protocols: Theory andapplications.In Proc. ACM SIGCOMM, September 2003.

[Sob05] Joao Luis Sobrinho.An algebraic theory of dynamic network routing.IEEE/ACM Transactions on Networking, 13(5):1160–1173,October 2005.

T. Griffin (cl.cam.ac.uk) An Albebraic Approach to Internet Routing Lectures 04 — 08T.G.Griffin c©2009 60 / 60