Distributed Algorithms
Total Page:16
File Type:pdf, Size:1020Kb
Distributed Algorithms Jukka Suomela Aalto University, Finland 2 January 2021 https://jukkasuomela.fi/da/ An extended and revised version of this book is now available online: https://jukkasuomela.fi/da2020/ Contents Foreword vi About the Course............................... vi Acknowledgements.............................. vi License..................................... vii Mathematical Preliminaries viii Power Tower.................................. viii Iterated Logarithm............................... viii Part I Informal Introduction 1 Warm-Up — Positive Results 2 1.1 Running Example: Colouring Paths...................2 1.2 Challenges of Distributed Algorithm..................2 1.3 Colouring with Unique Identifiers...................3 1.4 Faster Colouring with Unique Identifiers................5 1.4.1 Algorithm Overview.......................6 1.4.2 Algorithm for One Step.....................6 1.4.3 An Example...........................7 1.4.4 Correctness...........................7 1.4.5 Iteration.............................8 1.5 Colouring with Randomised Algorithms................8 1.5.1 Algorithm............................8 1.5.2 Analysis.............................8 1.5.3 With High Probability......................9 1.6 Summary................................9 1.7 Exercises.................................9 1.8 Bibliographic Notes........................... 10 2 Warm-Up — Negative Results 11 2.1 Locality................................. 11 2.2 Locality and 2-Colouring........................ 12 2.2.1 Algorithm for 2-Colouring Paths................ 12 2.2.2 Lower Bound for 2-Colouring.................. 13 2.3 Locality and 3-Colouring........................ 14 2.3.1 Proof Overview......................... 14 2.3.2 Colouring Functions....................... 15 2.3.3 Algorithms vs. Colouring Functions.............. 15 2.3.4 Observations........................... 16 i 2.3.5 Simple Base Case........................ 16 2.3.6 Recursive Step.......................... 17 2.3.7 Completing the Proof...................... 17 2.4 Exercises................................. 18 2.5 Bibliographic Notes........................... 19 Part II Graphs 3 Graph-Theoretic Foundations 21 3.1 Terminology............................... 21 3.1.1 Adjacency............................ 21 3.1.2 Subgraphs............................ 21 3.1.3 Walks.............................. 22 3.1.4 Connectivity and Distances................... 23 3.1.5 Isomorphism........................... 24 3.2 Packing and Covering.......................... 24 3.3 Labellings and Partitions........................ 25 3.4 Factors and Factorisations........................ 27 3.5 Approximations............................. 28 3.6 Directed Graphs and Orientations................... 28 3.7 Exercises................................. 29 3.8 Bibliographic Notes........................... 30 Part III Models of Computing 4 PN Model: Port Numbering 32 4.1 Introduction............................... 32 4.2 Port-Numbered Network........................ 33 4.2.1 Terminology........................... 34 4.2.2 Underlying Graph........................ 34 4.2.3 Encoding Input and Output................... 34 4.2.4 Distributed Graph Problems.................. 35 4.3 Distributed Algorithms in the PN model................ 35 4.3.1 State Machine.......................... 36 4.3.2 Execution............................ 36 4.3.3 Solving Graph Problems.................... 37 4.4 Example: Colouring Paths........................ 37 4.5 Example: Bipartite Maximal Matching................. 39 4.5.1 Algorithm............................ 39 4.5.2 Analysis............................. 39 4.6 Example: Vertex Covers......................... 42 4.6.1 Virtual 2-Coloured Network.................. 42 4.6.2 Simulation of the Virtual Network............... 42 4.6.3 Algorithm............................ 44 4.6.4 Analysis............................. 44 4.7 Exercises................................. 46 4.8 Bibliographic Notes........................... 47 ii 5 LOCAL Model: Unique Identifiers 48 5.1 Definitions................................ 48 5.2 Gathering Everything.......................... 48 5.3 Solving Everything........................... 50 5.4 Focus on Computational Complexity.................. 51 5.5 Algorithm BDGreedy ........................... 51 5.5.1 Algorithm............................ 51 5.5.2 Analysis............................. 52 5.5.3 Remarks............................. 53 5.6 Directed Pseudoforests......................... 53 5.7 Algorithm DPGreedy ........................... 53 5.7.1 Overview............................ 54 5.7.2 Algorithm............................ 54 5.7.3 Analysis............................. 54 5.8 Algorithm DPBit ............................. 56 5.8.1 Algorithm............................ 56 5.8.2 Analysis............................. 57 5.9 Algorithm DP3C ............................. 57 5.10 Algorithm BDColour ........................... 58 5.10.1 Preliminaries.......................... 58 5.10.2 Orientation........................... 58 5.10.3 Partition in Pseudoforests.................... 58 5.10.4 Parallel Colouring of Pseudoforests............... 58 5.10.5 Merging Colourings....................... 60 5.10.6 Summary............................ 61 5.11 Exercises................................. 61 5.12 Bibliographic Notes........................... 63 6 CONGEST Model: Bandwidth Limitations 64 6.1 Definitions................................ 64 6.2 Examples................................. 64 6.3 All-Pairs Shortest Path Problem..................... 65 6.4 Algorithm Wave ............................. 65 6.5 Algorithm BFS .............................. 66 6.6 Algorithm Leader ............................ 68 6.7 Algorithm APSP ............................. 69 6.8 Exercises................................. 71 6.9 Bibliographic Notes........................... 71 7 Randomised Algorithms 72 7.1 Definitions................................ 72 7.2 Probabilistic Analysis.......................... 72 7.3 With High Probability.......................... 73 7.4 Algorithm BDRand ............................ 74 7.4.1 Algorithm Idea......................... 74 7.4.2 Algorithm............................ 74 7.4.3 Analysis............................. 75 iii 7.5 Exercises................................. 77 7.6 Bibliographic Notes........................... 78 Part IV Proving Impossibility Results 8 Covering Maps 80 8.1 Definition................................ 80 8.2 Covers and Executions......................... 80 8.3 Examples................................. 82 8.4 Exercises................................. 85 8.5 Bibliographic Notes........................... 88 9 Local Neighbourhoods 89 9.1 Definitions................................ 89 9.2 Local Neighbourhoods and Executions................. 89 9.3 Exercises................................. 91 9.4 Bibliographic Notes........................... 92 10 Ramsey Theory 93 10.1 Monochromatic Subsets......................... 93 10.2 Ramsey Numbers............................ 93 10.3 An Application.............................. 94 10.4 Proof................................... 94 10.5 Exercises................................. 97 10.6 Bibliographic Notes........................... 98 11 Applications of Ramsey’s Theorem 99 11.1 Claim................................... 99 11.2 Preliminaries............................... 99 11.3 Subsets and Cycles........................... 99 11.4 Labelling................................. 100 11.5 Monochromatic Subsets......................... 100 11.6 Exercises................................. 102 11.7 Bibliographic Notes........................... 102 Part V Conclusions 12 Conclusions 104 12.1 What Have We Learned?........................ 104 12.2 What Else Exists?............................ 107 12.3 Research in Distributed Algorithms................... 108 12.4 Exercises................................. 108 12.5 Bibliographic Notes........................... 109 iv Index 110 Notation.................................... 110 Symbols.................................... 110 Models of Computing............................. 111 Algorithms................................... 111 Hints 112 Bibliography 117 v Foreword This book is an introduction to the theory of distributed algorithms. The topics covered include: • Models of computing: precisely what is a distributed algorithm, and what do we mean when we say that a distributed algorithm solves a certain computa- tional problem? • Algorithm design and analysis: which computational problems can be solved with distributed algorithms, which problems can be solved efficiently, and how to do it? • Computability and computational complexity: which computational prob- lems cannot be solved at all with distributed algorithms, which problems cannot be solved efficiently, and why is this the case? No prior knowledge of distributed systems is needed. A basic knowledge of discrete mathematics and graph theory is assumed, as well as familiarity with the basic concepts from undergraduate-level courses on models on computation, computational complexity, and algorithms and data structures. About the Course This textbook was written to support the lecture course CS-E4510 Distributed Al- gorithms at Aalto University. The course is worth 5 ETCS credits. There are 12 weeks of lectures: each week there is one 2-hour lecture and one 2-hour exercise session. Each week we will cover one chapter of this book. In each chapter there are at least 5 exercises, and the students are expected