The Power of Locality

Similar documents
From Shared Memory to Message Passing

Throughout this course, we use the terms vertex and node interchangeably.

GIAN Course on Distributed Network Algorithms. Distributed Objects

GIAN Course on Distributed Network Algorithms. Spanning Tree Constructions

GIAN Course on Distributed Network Algorithms. Spanning Tree Constructions

GIAN Course on Distributed Network Algorithms. Network Topologies and Local Routing

Distributed Computing over Communication Networks: Leader Election

Chapter 8 DOMINATING SETS

Chapter 8 DOMINATING SETS

GIAN Course on Distributed Network Algorithms. Network Topologies and Interconnects

All-to-All Communication

Vertex Coloring. Chapter Problem & Model 6 CHAPTER 1. VERTEX COLORING. Figure 1.2: 3-colorable graph with a valid coloring.

Consensus. Chapter Two Friends. 2.3 Impossibility of Consensus. 2.2 Consensus 16 CHAPTER 2. CONSENSUS

Network Algorithms. Distributed Sorting

CS Fall 2010 B-trees Carola Wenk

Maximal Independent Set

Algorithm 23 works. Instead of a spanning tree, one can use routing.

Problem 1.1 (Vertex Coloring). Given an undirected graph G = (V, E), assign a color c v to each vertex v V such that the following holds: e = (v, w)

Analysis of Algorithms

Red-Black Trees. 2/24/2006 Red-Black Trees 1

Chapter 6 DOMINATING SETS

CS256 Applied Theory of Computation

CSE 530A. B+ Trees. Washington University Fall 2013

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

9 Distributed Data Management II Caching

Distributed Algorithms 6.046J, Spring, 2015 Part 2. Nancy Lynch

Online Graph Exploration

Shared Memory. Chapter Model

Priority Queues and Binary Heaps

Vertex Coloring. Lecture The Problem. next previous size data

Balanced search trees. DS 2017/2018

Maximal Independent Set

Lecture Summary CSC 263H. August 5, 2016

Lecture 11: Multiway and (2,4) Trees. Courtesy to Goodrich, Tamassia and Olga Veksler

Lower Bound on Comparison-based Sorting

CMPS 2200 Fall 2017 B-trees Carola Wenk

Distributed Algorithms 6.046J, Spring, Nancy Lynch

Exploiting Locality in Distributed SDN Control. Stefan Schmid (TU Berlin & T-Labs) Jukka Suomela (Uni Helsinki)

13.4 Deletion in red-black trees

Shared Objects. Chapter Introduction

Exam Principles of Distributed Computing

Genetic programming. Lecture Genetic Programming. LISP as a GP language. LISP structure. S-expressions

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

Distributed Sorting. Chapter Array & Mesh

We will show that the height of a RB tree on n vertices is approximately 2*log n. In class I presented a simple structural proof of this claim:

Search Trees - 2. Venkatanatha Sarma Y. Lecture delivered by: Assistant Professor MSRSAS-Bangalore. M.S Ramaiah School of Advanced Studies - Bangalore

Thomas Moscibroda Roger Wattenhofer MASS Efficient Computation of Maximal Independent Sets in Unstructured Multi-Hop Radio Networks

(2,4) Trees. 2/22/2006 (2,4) Trees 1

Binary Trees. BSTs. For example: Jargon: Data Structures & Algorithms. root node. level: internal node. edge.

Algorithms for Euclidean TSP

CSCI 136 Data Structures & Advanced Programming. Lecture 25 Fall 2018 Instructor: B 2

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

6.852: Distributed Algorithms Fall, Instructor: Nancy Lynch TAs: Cameron Musco, Katerina Sotiraki Course Secretary: Joanne Hanley

Binary Heaps in Dynamic Arrays

Outline. Definition. 2 Height-Balance. 3 Searches. 4 Rotations. 5 Insertion. 6 Deletions. 7 Reference. 1 Every node is either red or black.

Self-Stabilizing Distributed Queuing

Treewidth and graph minors

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

Consensus. Chapter Two Friends. 8.3 Impossibility of Consensus. 8.2 Consensus 8.3. IMPOSSIBILITY OF CONSENSUS 55

1. Meshes. D7013E Lecture 14

Peer-to-peer clustering

Recoloring k-degenerate graphs

Models of distributed computing: port numbering and local algorithms

Distributed Computing

7 Distributed Data Management II Caching

Deterministic Leader Election in O(D + log n) Rounds with Messages of size O(1)

Verteilte Systeme/Distributed Systems Ch. 5: Various distributed algorithms

Distributed Systems Leader election & Failure detection

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0).

Red-Black Trees Goodrich, Tamassia. Red-Black Trees 1

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

TOWARDS LOSSLESS DATA CENTER RECONFIGURATION: CONSISTENT NETWORK UPDATES IN SDNS

Lecture 6: Analysis of Algorithms (CS )

Algorithms and Theory of Computation. Lecture 7: Priority Queue

DISTRIBUTED COMPUTING COLUMN. Stefan Schmid TU Berlin & T-Labs, Germany

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1

CSC 373: Algorithm Design and Analysis Lecture 4

6.856 Randomized Algorithms

Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013.

/ Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang

Lecture 7. Binary Search Trees and Red-Black Trees

Balanced Search Trees

Design and Analysis of Algorithms

Lecture 9: (Semi-)bandits and experts with linear costs (part I)

Learning Goals. CS221: Algorithms and Data Structures Lecture #3 Mind Your Priority Queues. Today s Outline. Back to Queues. Priority Queue ADT

CSE 373 MAY 10 TH SPANNING TREES AND UNION FIND

Balanced Trees Part Two

Scribe: Virginia Williams, Sam Kim (2016), Mary Wootters (2017) Date: May 22, 2017

CMSC 754 Computational Geometry 1

Greedy Algorithms CHAPTER 16

Discrete mathematics

Online Algorithms. Lecture 11

CMPS 2200 Fall 2015 Red-black trees Carola Wenk

An eccentric coloring of trees

No. (Betteridge's Law of Headlines)

Properties of red-black trees

Graph Algorithms. Chromatic Polynomials. Graph Algorithms

Notes on Binary Dumbbell Trees

2-3 Tree. Outline B-TREE. catch(...){ printf( "Assignment::SolveProblem() AAAA!"); } ADD SLIDES ON DISJOINT SETS

Transcription:

GIAN Course on Distributed Network Algorithms The Power of Locality Case Study: Graph Coloring Stefan Schmid @ T-Labs, 2011

Case Study: Graph Coloring

Case Study: Graph Coloring Assign colors to nodes.

Case Study: Graph Coloring Legal coloring: neighbors have different colors!

Case Study: Graph Coloring Optimal coloring: Minimal number of colors (aka chromatic number)

Applications Country Maps Medium Access Image Processing Neighboring states should have different colors! Famous 4-color theorem: any map can be painted with four colors! Interference-free, efficient utilization of spectrum Neighboring cells should have different frequencies! Colors = frequencies, channels, etc. Chromatic scheduling for physical simulation Process nodes of same color in parallel without determinacy race No coordination, no mutual exclusion needed 6

Legal coloring? Chromatic number? 7

Legal coloring? Chromatic number? Tree! 2 colors are enough 8

What about this example? 9

What about this example? 3 colors needed and enough 10

Now distributed! How to color a graph in a distributed manner? Stefan Schmid @ T-Labs, 2011 11

Now distributed! How to color a graph in a distributed manner? Stefan Schmid @ T-Labs, 2011 12

The LOCAL Model: A Convenient Synchronous Model in each Send round! receive compute. 13

The LOCAL Model: A Convenient Synchronous Model We will see in this course: there are techniques to execute an algorithm designed in the simple LOCAL model also in asynchronous networks! in each Send round! receive compute. 14

We will see in this course: there are The LOCAL Model: A techniques Convenient to execute Synchronous an algorithm Model designed in the simple LOCAL model also in asynchronous networks! in each Send round! Moreover, LOCAL algorithms can be made very robust (namely selfstabilizing), in an automatic manner! receive compute. 15

We will see in this course: there are The LOCAL Model: A techniques Convenient to execute Synchronous an algorithm Model designed in the simple LOCAL model also in asynchronous networks! in each Send round! Moreover, LOCAL algorithms can be made very robust (namely selfstabilizing), in an automatic manner! receive Unlike CONGEST model: message size and link capacity not bounded. compute. 16

LOCAL Performance Metrics Time Complexity: Number of communication rounds Message Complexity: Number of messages sent Local Computation: Complexity of local computations

LOCAL Performance Metrics What else? Time Complexity: Number of communication rounds Message Complexity: Number of messages sent Local Computation: Complexity of local computations

LOCAL Performance Metrics What else? Time Complexity: Quality of solution: Approximation ratio for example ( price of locality ). Number of communication rounds Message Complexity: Number of messages sent Local Computation: Complexity of local computations

Now distributed!how to color a tree in a distributed manner? Stefan Schmid @ T-Labs, 2011

Now distributed! How to color a rooted tree in a distributed manner? Simplification: Assume unique node IDs Assume rooted Root ID 0 0 Stefan Schmid @ T-Labs, 2011

Now distributed! How to color a rooted tree in a distributed manner? Simplification: Assume unique node IDs Assume rooted Root ID 0 0 Idea: interpret ID as color! Communicate my color to children and take opposite color from my parent! Stefan Schmid @ T-Labs, 2011

Slow Distributed Tree Coloring: Example 0 Round 1 23

Slow Distributed Tree Coloring: Example 0 1 1 Round 2 24

Slow Distributed Tree Coloring: Example 0 1 1 0 0 0 0 0 Round 3 25

Slow Distributed Tree Coloring: Example 0 1 1 0 0 0 0 0 Round 3 1 26

Slow Tree Slow Tree Algo If root: color 0, send 0 to children Otherwise: each node v: Wait for message x from parent Choose color y=1-x Send y to children Stefan Schmid @ T-Labs, 2011 27

Slow Tree: Analysis Approximation quality: Time complexity: Message complexity: Local complexity: 28

Slow Tree: Analysis Approximation quality: # colors? Time complexity: # rounds? Message complexity: # messages? Local complexity: local computations? 29

Slow Tree: Analysis Approximation quality: 2 colors suffice! Time complexity: O(n), depth of the tree Message complexity: O(n) Local complexity: trivial, just flip! 30

Slow Tree: Analysis Can we do faster? Approximation quality: 2 colors suffice! Time complexity: O(n), depth of the tree Message complexity: O(n) Local complexity: trivial, just flip! 31

Ultra Fast Distributed Tree Coloring Yes we can! 3-coloring in O(log* n) rounds 32

Ultra Fast Distributed Tree Coloring Yes we can! 3-coloring in O(log* n) rounds Idea: based on ID manipulations Again: interpret ID as color Unique IDs legal (but expensive) coloring! How can we quickly reduce the ID space? 33

Intuition: n vs log* n log n: How many times do I have to :2 until <2? n, n/2, n/4, n/8,, 8, 4, 2, 1 log n

Intuition: n vs log* n log n: How many times do I have to :2 until <2? n, n/2, n/4, n/8,, 8, 4, 2, 1 log n loglog n: How many times do I have to x until <2? n, n, n, n,, <2 loglog n

Intuition: n vs log* n log n: How many times do I have to :2 until <2? n, n/2, n/4, n/8,, 8, 4, 2, 1 log n loglog n: How many times do I have to x until <2? n, n, n, n,, <2 loglog n log* n: How many times do I have to log x until <2? n, log n, loglog n, logloglog n,, <2 log* n

n = atoms in universe 10 80 log*(atoms in universe) 5

Slow Algo No parallelism! Fast Algo Efficient parallel manipulations! Time: n Time: log* n

Log*-Time Coloring with Label Manipulation Initially ID = label of node v =color c v 0010110000 0110010000 1010010000 initially 39

Log*-Time Coloring with Label Manipulation Initially ID = label of node v =color c v log n 0010110000 Log n bits to represent n unique IDs 1010010000 initially 0110010000 Initially ID = label of node v =color c v Unique IDs legal (but expensive) coloring! 40

Log*-Time Coloring with Label Manipulation Send ID to children 0010110000 1010010000 Round 1 0110010000 Send ID to children Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 41

Log*-Time Coloring with Label Manipulation 0010110000 1010010000 Round 1 0110010000 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 42 ID = color for next round: the position!

Log*-Time Coloring with Label Manipulation Example: Differ at position 5 = (0101) 2 0010110000 0010110000 1010010000 01010 Differ at position 8 = (1000) 2 1010010000 Round 1 1010010000 0110010000 10001 0110010000 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 43

Log*-Time Coloring with Label Manipulation Differ at position 5 = (0101) 2 0010110000 1010010000 01010 Differ at position 8 = (1000) 2 1010010000 0110010000 10001 0110010000 1010010000 0010110000 How long are the new IDs? Round 1 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 44

Log*-Time Coloring with Label Manipulation Differ at position 5 = (0101) 2 0010110000 1010010000 01010 Differ at position 8 = (1000) 2 1010010000 0110010000 10001 0110010000 1010010000 0010110000 How long are the new IDs? Round 1 Describing position in x-bit string takes log x bits, so: loglog n bits Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 45

Log*-Time Coloring with Label Manipulation Differ at position 5 = (0101) 2 0010110000 1010010000 01010 Differ at position 8 = (1000) 2 1010010000 0110010000 10001 0110010000 1010010000 0010110000 How long are the new IDs? Round 1 Describing position in x-bit string takes log x bits, so: loglog n bits Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) +1 bit 46

Log*-Time Coloring with Label Manipulation 10010 01010 Round 2 10001 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 47

Log*-Time Coloring with Label Manipulation Differ at position 3 = (11) 2 10010 10010 01010 111 01010 Round 2 10001 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 48

Log*-Time Coloring with Label Manipulation How long are the new IDs? Differ at position 3 = (11) 2 10010 10010 01010 111 01010 Round 2 10001 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 49

Log*-Time Coloring with Label Manipulation How long are the new IDs? Differ at position 3 = (11) 2 10010 10010 01010 111 01010 Round 2 10001 Describing position in x-bit string takes log x bits, so: logloglog n bits Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) +1 bit 50

Log*-Time Coloring with Label Maniplulation 111 Round 3 001 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 51

Log*-Time Coloring with Label Maniplulation 111 etc.! 001 Algorithm: in round i, node v: 1. Send my c v to children (in parallel!) 2. Receive parent ID/color c p 3. Let i be the smallest index where c v and c p differ (from right, binary) 4. My new c v = i c v (i) 52

Analysis How long does it take until O(1) colors? Why is coloring always legal? 53

Analysis How long does it take until O(1) colors? # bits/colors reduced by a log-factor in each round The definition of log*! log* n: How many times do I have to log x until <2? Why is coloring always legal? Algorithm: My new c v = i c v (i) 54

Analysis How long does it take until O(1) colors? # bits/colors reduced by a log-factor in each round The definition of log*! log* n: How many times do I have to log x until <2? Why is coloring always legal? Algorithm: My new c v = i c v (i) grandfather: c g By contradiction: To get the same ID as my father, I need to differ at same position from father as father from grandfather. But then last bit must be different: there I took my own bit (and father will do the same with his different bit)! father: c f me: c v 55

Summary of Algorithm 56

Summary of Algorithm Note: we stop if color in {0,,5}: why? 57

Summary of Algorithm Note: we stop if color in {0,,5}: why? Could I go down to 2-bit colors, i.e., {0,,3}: No, requires 2 bits to address index where they differ, plus adding the difference-bit gives more than two bits. 58

Summary of Algorithm Note: We we stop if color in {0,,5}: why? Could I I go down to to2-bit colors, i.e., i.e., {0,,3}: No, requires 2 bits 2 bits to to address index where they differ, plus adding the the difference-bit gives more than two bits. For 3-bit colors {0,,7} this still works: e.g., 7=(111) 2 can be described with 3 bits, and position index (0,1,2) requires two bits, plus one difference-bit gives three again 59

Summary of Algorithm Note: We we stop if color in {0,,5}: why? Could I I go down to to2-bit colors, i.e., i.e., {0,,3}: No, requires 2 bits 2 bits to to address index where they differ, plus adding the the difference-bit gives more than two bits. For 3-bit colors {0,,7} this still works: e.g., 7=(111) 2 can be described with 3 bits, and position index (0,1,2) requires two bits, plus one difference-bit gives three again But actually colors 110 (for color 6 ) and 111 (for color 7 ) are not needed, as we can do another round! IDs of three bits can only differ at positions 00 (for 0 ), 01 (for 1 ), 10 (for 2 ) 60

With 6-COLORS algorithm we can get down to 6 colors. What about improving it to 2 colors?

With 6-COLORS algorithm we can get down to 6 colors. What about improving it to 2 colors? Impossible: takes linear time. What about 3 colors?

Observation: Shift Down Let us note a simple trick: shift colors down by one level makes siblings independent. And preserves legal coloring

Observation: Shift Down Let us note a simple trick: shift colors down by one level makes siblings independent. And preserves legal coloring Result: all my descendants have same color! At most 2 colors are occupied: father and descendants! 3rd color free!

Observation: Shift Down Let us note a simple trick: shift colors down by one level makes siblings independent. And preserves legal coloring Shift Down Each node v concurrently does: recolor v with color of parent Formally Result: all my descendants have same color! At most 2 colors are occupied: father and descendants! 3rd color free!

6-to-3 6-to-3 Each other node v does (in parallel): 1. Run 6-Colors for log*(n) rounds 2. For x=5,4,3: 1. Perform Shift Down 2. If (c v =x) choose new color c v ϵ {0,1,2} according first free principle 66

6-to-3 6-to-3 Each other node v does (in parallel): 1. Run 6-Colors for log*(n) rounds 2. For x=5,4,3: 1. Perform Shift Down 2. If (c v =x) choose new color c v ϵ {0,1,2} according first free principle Why still log* n time? 67

6-to-3 6-to-3 Each other node v does (in parallel): 1. Run 6-Colors for log*(n) rounds 2. For x=5,4,3: 1. Perform Shift Down 2. If (c v =x) choose new color c v ϵ {0,1,2} according first free principle Why still log* n time? Just 3 more rounds! 68

6-to-3 6-to-3 Why not do in same step? Each other node v does (in parallel): 1. Run 6-Colors for log*(n) rounds 2. For x=5,4,3: 1. Perform Shift Down 2. If (c v =x) choose new color c v ϵ {0,1,2} according first free principle 69

6-to-3 6-to-3 Why not do in same step? Each other node v does (in parallel): 1. Run 6-Colors for log*(n) rounds 2. For x=5,4,3: 1. Perform Shift Down 2. If (c v =x) choose new color c v ϵ {0,1,2} according first free principle Could be harmful: same 3rd color! Need to do it for E.g. 5 => 1 independent sets. E.g. 4 => 1

Example: Shift Down + Drop Color 4 4 shift down! shift down 1 first free for 4! 1 3 2 4 4 0 2 4 1 3 3 3 3 Siblings no longer have same color: must do shift down again first! 71

Example: 6-to-3 4 shift down 2 2 5 1 2 3 5 2 5 4 5 3 4 3 3 4 2 new color for 5: first free 2 shift down 1 0 4 0 3 4 3 3 4 2 4 4 2 4 4 Careful: cannot recolor 4 at same time! 2 3 72

Remark: Optimality One can show that no local algorithm can 3-color a graph faster than in O(log* n). 73

Remark: Optimality One can show that no local algorithm can 3-color a graph faster than in O(log* n). In fact: in 0 rounds: n colors in 1 round: log n colors in 2 rounds: loglog n colors etc.! 74

Remark: Optimality One can show that no local algorithm can 3-color a graph faster than in O(log* n). In fact: in 0 rounds: n colors in 1 round: log n colors in 2 rounds: loglog n colors etc.! Proof idea: Recall the elephant! A local coloring algorithm can be seen as a function: f: neighborhood color A deterministic algorithm needs to decide in the same way given same neighborhood: risk illegal coloring. Only with communication neighborhoods start look different and require less colors. 75

Lower Bound Set of neighborhoods Local coloring algo Vertex coloring 4 ALG ALG 4 7 4 7 7

Lower Bound Can reduce problem of finding lower bound to determine chromatic number of special neighborhood dependency graphs. Set of neighborhoods Local coloring algo Vertex coloring 4 ALG ALG 4 7 4 7 7

Concluding Remarks Can we reduce to 2 colors? Not without increasing runtime significantly! (Linear time, more than exponentially worse!) Simple on purpose: results more general! log* runtime is also possible on more general graphs Many results: see ACM PODC conference! 78

Where can I learn more? Distributed Computing book by David Peleg Lecture notes by Roger Wattenhofer ETH Zurich ACM Survey by Jukka Suomela Research: ACM PODC Conference 79