DDA 2010, lecture 1: Introduction

• Synchronous deterministic distributed algorithms • Two models: • Port-numbering model • Unique identifiers Some notational conventions

•Graphs: • unless otherwise mentioned, graphs are undirected and simple • graphs are pairs: G = (V, E), V set of nodes, E set of edges • undirected edges are unordered pairs: if there is an edge between u ∈ V and v ∈ V, we have {u, v} ∈ E • directed edges are ordered pairs, e.g. (u, v) ∈ E • deg(v) = degree of v ∈ V

2 Some notational conventions

• Parameters: • n = |V|, number of nodes • Δ is an upper bound on degrees: deg(v) ≤Δ for all v ∈ V • These are often used in algorithm analysis • e.g., “running time O(Δ + log n)” • Sometimes we assume that Δ is a global constant • “bounded-degree graphs”, Δ = O(1)

3 DDA 2010, lecture 1a: Port-numbering model

• Synchronous deterministic distributed algorithms in the port-numbering model • Limited model, we will study extensions later

4 Distributed algorithms

• Communication graph G G • Node = computer • e.g., Turing machine, finite state machine • Edge = communication link • computers can exchange messages

5 Distributed algorithms

• All nodes are identical, G run the same algorithm • We can choose the algorithm •An adversary chooses the structure of G • Our algorithm must produce a correct output in any graph G

6 Distributed algorithms

• Usually, computational G problems are related to the structure of the communication graph G • example: find a maximal independent set for G • the same graph is both the input and the system that tries to solve the problem...

7 Port-numbering model

1 • A node of degree d can 2 1 refer to its neighbours 3 1 by integers 1, 2, ..., d 2 2 1 • Port-numbering chosen by adversary 1 2 2 1 1 1 3 2

8 Synchronous distributed algorithms

1. Each node reads its 4 own local input 1 2 2 3 1 • Depends on the problem, for example:

2 1 1 • node weight 1 3 • weights of 2 incident edges • May be empty

9 Synchronous distributed algorithms

1. Each node reads its own local input 1 2 2 2. Repeat synchronous communication rounds 1 1 ... 1 3 2

10 Synchronous distributed algorithms

1. Each node reads its own local input 0 1 2 2 2. Repeat synchronous 0 1 communication rounds 1 1 until all nodes 1 3 1 have announced 2 their local outputs • Solution of the problem

11 Synchronous distributed algorithms

1. Each node reads its own local input 0 1 2 2 2. Repeat synchronous 0 1 communication rounds 1 1 until all nodes 1 3 1 have announced 2 their local outputs

Example: Find a maximal independent set I Local output of a node v indicates whether v ∈ I

12 Synchronous distributed algorithms

• Communication round: each node 1 2 2 1.sends a message to each port

1 1 1 3 2

13 Synchronous distributed algorithms

• Communication round: each node 1 2 2 1.sends a message to each port

1 1 1 3 (message propagation...) 2

14 Synchronous distributed algorithms

• Communication round: each node 1 2 2 1.sends a message to each port

1 1 2.receives a message 1 3 from each port 2

15 Synchronous distributed algorithms

• Communication round: each node 1 2 2 1.sends a message to each port

1 1 2.receives a message 1 3 from each port 2 3.updates its own state

16 Synchronous distributed algorithms

• Communication round: each node 0 1 2 2 1.sends a message to each port 1 1 1 2.receives a message 1 3 from each port 2 3.updates its own state 4.possibly stops and announces its output

17 Synchronous distributed algorithms

• Communication rounds are repeated until all 1 0 nodes have stopped and 2 2 announced their outputs 0 1 • Running time = 1 1 1 3 number of rounds 1 2 • Worst-case analysis

18 Synchronous distributed algorithms: networks of state machines

• Equivalently:

1 • Node = state machine a (not necessarily finite) 2 2 • All nodes update their b d states simultaneously 1 1 1 3 c 2

19 Synchronous distributed algorithms: networks of state machines

• Equivalently:

1 • Node = state machine a (not necessarily finite) 2 2 • All nodes update their b d states simultaneously 1 1 1 3 c 2 a’ = f (a, b, 2, c, 1) 2 Current state + b’ = f3(b, d, 1, a, 1, c, 2) port number:

c’ = f2(c, a, 2, b, 3) we can reconstruct the outgoing message d’ = f1(d, b, 1)

20 Synchronous distributed algorithms: networks of state machines

• Equivalently:

1 • Node = state machine a (not necessarily finite) 2 2 • All nodes update their b d states simultaneously 1 1 1 3 c 2 a’ = f2(a, b, 2, c, 1) Same function b’ = f3(b, d, 1, a, 1, c, 2) f2 = algorithm for c’ = f2(c, a, 2, b, 3) degree-2 nodes d’ = f1(d, b, 1)

21 Synchronous distributed algorithms: networks of state machines

• Equivalently:

1 • Node = state machine a (not necessarily finite) 2 2 • All nodes update their b d states simultaneously 1 1 1 3 c • Initial state = local input 2 a’ = f2(a, b, 2, ...) (incl. degree of the node) b’ = f3(b, d, 1, ...) • Final state = local output c’ = f2(c, a, 2, ...)

d’ = f1(d, b, 1)

22 DDA 2010, lecture 1b: Computability in port-numbering model

• Impossibility of symmetry breaking • Covering maps and covering graphs: tools for proving more impossibility results

23 Symmetry can’t be broken

• Input may be symmetric

1 • 2 2 • symmetric port numbering

1 1 • identical local inputs 2

24 Symmetry can’t be broken

• Same input X 1 • Same algorithm 2 2 X • Same initial state

X 1 1 2

25 Symmetry can’t be broken

• Same current state

1 • Messages sent to port 1 2 2 are identical to each other

1 1 • Messages sent to port 2 2 are identical to each other

26 Symmetry can’t be broken

1 2 2

1 1 2

27 Symmetry can’t be broken

• Messages received from port 1 are identical to 1 each other 2 2 • Messages received from port 2 are identical to 1 1 each other 2

28 Symmetry can’t be broken

• Same old state

1 • Same set of 2 2 received messages • Same deterministic 1 1 algorithm 2 • Same new state

29 Symmetry can’t be broken

• Same new state • Either none of Z 1 2 2 the nodes stops — Z or all of them stop and produce 1 1 identical outputs Z 2 • Symmetry can’t be broken! • let’s formalise this...

30 Covering maps

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 f 2 1 1 2 2 1 1 Covering map f: V’ → V 1 3 • surjection 2 • preserves neighbourhoods G = (V, E) • preserves port numbering

31 Covering maps

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 Covering map f: V’ → V 1 3 • surjection 2 • preserves neighbourhoods G = (V, E) • preserves port numbering

32 Covering maps

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 Covering map f: V’ → V 1 3 • surjection 2 • preserves neighbourhoods G = (V, E) • preserves port numbering

33 Covering maps

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 Covering map f: V’ → V 1 3 • surjection 2 • preserves neighbourhoods G = (V, E) • preserves port numbering

34 Covering maps

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 Covering map f: V’ → V 1 3 • surjection 2 • preserves neighbourhoods G = (V, E) • preserves port numbering

35 Covering maps and covering graphs

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 1 3 H is a of 2 G if there is a covering G = (V, E) map f: V’ → V

36 Covering maps and covering graphs

• Run the same algorithm in G and H • v’ ∈ V’ and f(v’) ∈ V have the same input for all v’

• Then v’ ∈ V’ and f(v’) ∈ V: G = (V, E) 1 2 • have identical initial statess 2 1 1 1 3 • send and receive the same messagesmessages 2

• have identical state transitionstions H = (V’, E’) 2 1 2 1 2 • produce identical 1 1 3 1 1 local outputs! 2 3 1 2 1 2

37 Covering maps and covering graphs

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 Same output 1 3 2 G = (V, E)

38 Covering maps and covering graphs

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 Same output 1 3 2 G = (V, E)

39 Covering maps and covering graphs

2 1 2 1 H = (V’, E’) 2 1 1 3 1 1 2 3 1 2 1 2 1 2 2 1 1 Same output 1 3 2 G = (V, E)

40 Covering maps and covering graphs

• Symmetric cycles are a simple special case of covering maps

G = (V, E) 1 H = (V’, E’) 2 2 21 1 1 2

Same output

41 Computability in the port-numbering model

• Very limited model 1 • in a cycle, we can only 2 2 find a trivial solution: 1 1 empty set, all nodes, ... 2 • we can’t even break symmetry in a 2-node network! 1 1 • What can be solved?

42 DDA 2010, lecture 1c: Algorithms in port-numbering model

• Some problems can be solved in the port-numbering model... • and covering graphs can be used as an algorithm design technique, too! • Example: approximation

43 Symmetry breaking out of thin air: bipartite double covers

• Replace each node by two virtual nodes: black and white • original nodes simulate virtual nodes • each computers runs two programs in parallel: “black program” and “white program” • Edges: black-to-white

44 Symmetry breaking out of thin air: bipartite double covers

G = (V, E) • Virtual graph H is a covering graph of G •It is a double cover: 2 nodes of H map to each node of G H = (V’, E’) •It is bipartite • and we have already coloured its two parts: black and white!

45 Symmetry breaking out of thin air: bipartite double covers

2-coloured graph a b d c c c a a a

a b d b b b d = c c d d

46 Symmetry breaking out of thin air: bipartite double covers

Port-numbering inherited a 1 2 2 1 1 b d 1 1 1 3 c c c 2 2 2 2 2 a a a 1 1 3 3 a b d b 2 2 b b d = 1 1 c 1 1 c d d

47 Symmetry breaking out of thin air: bipartite double covers

Port-numbering inherited a 1 2 2 1 1 b d 1 1 1 3 c c c 2 2 2 2 2 a a a 1 1 3 3 a b d b 2 2 b b d = 1 1 c 1 1 c d d

48 Symmetry breaking out of thin air: bipartite double covers

Port-numbering inherited a 1 2 2 1 1 b d 1 1 1 3 c c c 2 2 2 2 2 a a a 1 1 33 a b d b 2 2 b b d = 1 1 c 1 1 c d d

49 Symmetry breaking out of thin air: bipartite double covers

• Port-numbered graphs without colouring: • not possible to find c 1 1 c a maximal matching 2 2 (consider an even cycle) 2 2 a a • Port-numbered graphs 1 1 with 2-colouring: 33 b 2 2 b • very easy to find 1 1 a maximal matching! 1 1 d d

50 Maximal matching in 2-coloured graphs

• Each white node sends proposals to its black neighbours c 1 1 c • one by one, 2 2 order by port numbers 2 2 a a 1 1 33 b 2 2 b 1 1 1 1 d d

51 Maximal matching in 2-coloured graphs

• Each white node sends proposals to its black neighbours c 1 1 c • one by one, 2 2 order by port numbers 2 2 a a • Each black node accepts 1 1 the first proposal it gets 33 b 2 2 b • break ties using 1 1 port numbers 1 1 d d

52 Maximal matching in 2-coloured graphs

• Each white node sends proposals to its black neighbours c 1 1 c • one by one, 2 2 order by port numbers 2 2 a a • until its proposal 1 1 is accepted, or 33 all neighbours b 2 2 b have rejected 1 1 1 1 d d

53 Maximal matching in 2-coloured graphs

• Each white node sends proposals to its black neighbours c 1 1 c • one by one, 2 2 order by port numbers 2 2 a a • Each black node accepts 1 1 the first proposal it gets 33 b 2 2 b • break ties using 1 1 port numbers 1 1 d d

54 Maximal matching in 2-coloured graphs

• Accepted proposals M: M ⊆ E’ matching • white nodes don’t propose c 1 1 c after acceptance 2 2 2 2 • black nodes don’t accept a a more than once 1 1 • all nodes incident to 33 2 2 at most one edge b b 1 1 1 1 d d

55 Maximal matching in 2-coloured graphs

• Accepted proposals M: M ⊆ E’ maximal matching! • assume {u, v} ∈ E \ M c 1 1 c u unmatched 2 2 2 2 • then u has sent a proposal a a to v and v has rejected it 1 1 33 • therefore v had already b 2 2 b received another proposal, 1 1 v is matched 1 1 • can’t add {u, v} to M d d

56 Maximal matching in bipartite double cover

Map back to original graph a 1 D ⊆ E 2 2 1 1 b d 1 1 1 3 c c c 2 2 2 At least 1 of 2 2 2 virtual edges in M a a a 1 1 33 a b d b 2 2 b b d = 1 1 c 1 1 c M ⊆ E’ d d

57 Maximal matching in bipartite double cover

Different possibilities... a D ⊆ E b d c c c At least 1 of 2 virtual edges in M a a a

a b d b b b d = c c M ⊆ E’ d d

58 Maximal matching in bipartite double cover

Different possibilities... a D ⊆ E b d c c c a a a

a b d b b b d = c c M ⊆ E’ d d

59 Maximal matching in bipartite double cover

• However, this is not a D ⊆ E possible, because b d M is a matching c • M induces a subgraph of H with max. degree 1

a • therefore: D induces a subgraph of a b d G with max. degree 2 b d c c M ⊆ E’

60 Maximal matching in bipartite double cover

• And this is not possible, a D ⊆ E because M is maximal b d • each edge of H is c in M or shares at least one endpoint with M • endpoints of M form a a vertex cover in H a b d • endpoints of D form b d c a vertex cover in G! c M ⊆ E’

61 Finding a vertex cover

• So we will find a set D of edges such that: • D induces a subgraph of maximum degree 2 • D must consist of paths and cycles • endpoints of D form a vertex cover C • is it a small vertex cover?

62 Finding a vertex cover

• So we will find a set D An optimal vertex cover of edges such that: C* needs to • D induces a subgraph of cover these maximum degree 2 edges, too! • D must consist of paths and cycles Thus C* • endpoints of D form must contain a vertex cover C 2 of these • is it a small vertex cover? 5 nodes

63 Finding a vertex cover

• Different cases: • Cycle with 3 edges: 3 nodes in C, ≥ 2 in C* • Cycle with 4 edges: 4 nodes in C, ≥ 2 in C* • Cycle with 5 edges: 5 nodes in C, ≥ 3 in C* ...

|C| ≤ 2|C*|

64 Finding a vertex cover

• Different cases: • Path with 1 edge: 2 nodes in C, ≥ 1 in C* • Path with 2 edges: 3 nodes in C, ≥ 1 in C* • Path with 3 edges: 4 nodes in C, ≥ 2 in C* • Path with 4 edges: 5 nodes in C, ≥ 2 in C* |C| ≤ 3|C*| ...

65 Finding a vertex cover

• In each path or cycle: • C has at most 3 times as many nodes as C* • Summing over all paths and cycles: •|C| ≤ 3|C*| • The algorithm finds a 3-approximation of minimum vertex cover!

66 Finding a vertex cover: summary

• Vertex cover is a graph problem that can be solved reasonably well in the port-numbering model with a deterministic distributed algorithm • And the algorithm was simple and fast: O(Δ) rounds!

67 Finding a vertex cover: two very different worlds

• Centralised setting, polynomial-time algorithms: • trivial to find a minimal vertex cover: greedy algorithm • it requires more thought to find a good approximation of minimum vertex cover • Distributed setting, port-numbering model: • impossible to find a minimal vertex cover: symmetry breaking issues • but we have seen that it is possible to find a good approximation of minimum vertex cover

68 Finding a vertex cover: symmetry breaking

• Vertex cover approximation does not require symmetry breaking • Proof: algorithm in the port-numbering model • However, many interesting problems do... • Let’s study a stronger model of distributed computing

69