Network Optimization by Randomization (Distributed Computing): Vertex Coloring Stefan Schmid @ T-Labs, 2011
An Excursion to Distributed Computing! This part of the lecture comes with a „Skript“! Stefan Schmid @ T-Labs, 2011
Randomization for Distributed Algorithms What are distributed/local algorithms? 1. Computations are done at different components (e.g., routers, peers, etc.), and not centrally! 2. „Nodes“ first have only local view (= know states of neighboring nodes in the graph/network only) and need to communicate to find solution. Model „rounds“: Evaluation criteria? 1. number of rounds (time complexity) 2. number of messages (message complexity) 3. complexity of local computations 4. quality of output! ☺ Stefan Schmid @ T-Labs, 2011
Randomization for Distributed Algorithms What is cool about distributed / local algorithms? Good scalability, no need to know entire network state (quick and dynamic!), no single point of failure, .... Examples? Routing (e.g., hot-potato routing, routing in peer-to-peer networks, ...), DNS, grid computing, aggregation in sensor networks, etc. Stefan Schmid @ T-Labs, 2011
Stefan Schmid @ T-Labs, 2011 Graph Coloring
How to color? Chromatic number? Tree! Two colors enough... Stefan Schmid @ T-Labs, 2011
And now? Three colors enough... Stefan Schmid @ T-Labs, 2011
Graph Coloring Why color a network? Stefan Schmid @ T-Labs, 2011
Graph Coloring Medium access: reuse frequencies in wireless networks at certain spatial distance such that there is „no“ interference. Break symmetries: more generally... Note: gives independent sets... How? Stefan Schmid @ T-Labs, 2011
Science : „Human coloring“! Human interaction as local algorithm? How good are „we“? Stefan Schmid @ T-Labs, 2011
Simple Coloring Algorithm? (Not distributed!) Greedy Sequential while (uncolored vertices v left): color v with minimal color that does not conflict with neighbors Analysis? # rounds/steps? # colors? Stefan Schmid @ T-Labs, 2011
Simple Coloring Algorithm? (Not distributed!) Greedy Sequential while (uncolored vertices v left): color v with minimal color that does not conflict with neighbors # steps At most n steps: walk through all nodes... # colors Δ+ 1, where Δ is max degree. Because: there is always a color free in {1, ..., Δ +1} Note: many graphs can be colored with less colors! Examples? Stefan Schmid @ T-Labs, 2011
How to do it in a distributed manner? Stefan Schmid @ T-Labs, 2011 Now distributed!
Now distributed! ID=4 First Free 4 ID=2 Assume initial coloring (e.g., unique ID=color) 1. Each node uses smallest available color ID=1 ID=3 in neighborhood 1 Assume: two neighbors never choose color at the same time... Reduce 4 Initial coloring = IDs Each node v: 2 1. v sends ID to neighbors (idea: sort neighbors!) 2. while (v has uncolored neighbor with higher ID) 1. v sends „undecided“ to neighbors 3. v chooses free color using First Free 1 4. v sends decision to neighbors Analysis? Not parallel! Stefan Schmid @ T-Labs, 2011
Now distributed! Let us focus on trees now.... Chromatic number? Algo? Stefan Schmid @ T-Labs, 2011
Slow Tree Slow Tree 1. Color root 0, send to kids Each node v does the following: • Receive message x from parent • Choose color y=1-x • Send y to kids Stefan Schmid @ T-Labs, 2011
Slow Tree Two colors suffice: root sends binary message down... Stefan Schmid @ T-Labs, 2011
Slow Tree Two colors suffice: root sends binary message down... Stefan Schmid @ T-Labs, 2011
Slow Tree Two colors suffice: root sends binary message down... Stefan Schmid @ T-Labs, 2011
Slow Tree Two colors suffice: root sends binary message down... Time complexity? Message complexity? Local compuations? Synchronous or asynchronous? Stefan Schmid @ T-Labs, 2011
Slow Tree Two colors suffice: root sends binary message down... Time complexity? depth · n Message complexity? n-1 Local compuations? laughable... Synchronous or asynchronous? both! Stefan Schmid @ T-Labs, 2011
Discussion Time complexity? depth · n Message complexity? n-1 Local compuations? laughable... Synchronous or asynchronous? both! Can we do better? Stefan Schmid @ T-Labs, 2011
Local Vertex Coloring for Tree? Can we do faster than diameter of tree?! Yes! With constant number of colors in log*(n) time!! One of the fastest non-constant time algos that exist! (... besides inverse Ackermann function or so) (log = divide by two, loglog = ?, log* = ?) log* (# atoms in universe) ≈ 5 Why is this good? If something happens (dynamic network), back to good state in a sec! There is a lower bound of log-star too, so that‘s optimal! Stefan Schmid @ T-Labs, 2011
How does it work? Initially: each node has unique log(n)-bit ID = legal coloring (interpret ID as color => n colors) 0010110000 1010010000 ... ... 0110010000 Idea: root should have label 0 (fixed) in each step: send ID to c v to all children; receive c p from parent and interpret as little-endian bit string: c p =c(k)...c(0) let i be smallest index where c v and c p differ set new c v = i (as bit string) || c v (i) until c v ∈ {0,1,2,...,5} (at most 6 colors) Stefan Schmid @ T-Labs, 2011
6-Colors 6-Colors Assume legal initial coloring Root sets itself color 0 Each other node v does (in parallel): 1. Send c v to kids 2. Repeat (until c w ∈ {0,...,5} for all w): 1. Receive c p from parent 2. Interpret c v /c p as little-endian bitstrings c(k)...c(1)c(0) 3. Let i be smallest index where c v and c p differ 4. New label is: i||c v (i) 5. Send c v to kids Stefan Schmid @ T-Labs, 2011
How does it work? Initially: each node has unique log(n)-bit ID = legal coloring (interpret ID as color => n colors) 0010110000 1010010000 ... Round 1 ... 0110010000 Idea: root should have label 0 (fixed) in each step: send ID to c v to all children; receive c p from parent and interpret as little-endian bit string: c p =c(k)...c(0) let i be smallest index where c v and c p differ set new c v = i (as bit string) || c v (i) until c v ∈ {0,1,2,...,5} (at most 6 colors) Stefan Schmid @ T-Labs, 2011
How does it work? Initially: each node has unique log(n)-bit ID = legal coloring (interpret ID as color => n colors) Differ at position 5 = (0101) 2 0010110000 0010110000 1010010000 0101 0 1010010000 ... Round 1 ... Differ at position 8 = (1000) 2 0110010000 1010010000 0110010000 1000 1 Idea: root should have label 0 (fixed) in each step: send ID to c v to all children; receive c p from parent and interpret as little-endian bit string: c p =c(k)...c(0) let i be smallest index where c v and c p differ set new c v = i (as bit string) || c v (i) until c v ∈ {0,1,2,...,5} (at most 6 colors) Stefan Schmid @ T-Labs, 2011
How does it work? Initially: each node has unique log(n)-bit ID = legal coloring (interpret ID as color => n colors) 10010 01010 ... Round 2 ... 10001 Idea: root should have label 0 (fixed) in each step: send ID to c v to all children; receive c p from parent and interpret as little-endian bit string: c p =c(k)...c(0) let i be smallest index where c v and c p differ set new c v = i (as bit string) || c v (i) until c v ∈ {0,1,2,...,5} (at most 6 colors) Stefan Schmid @ T-Labs, 2011
How does it work? Initially: each node has unique log(n)-bit ID = legal coloring (interpret ID as color => n colors) 10010 10010 Differ at position 3 = (11) 2 10010 01010 11 1 01010 01010 ... Round 2 ... ... 10001 10001 Idea: root should have label 0 (fixed) in each step: send ID to c v to all children; receive c p from parent and interpret as little-endian bit string: c p =c(k)...c(0) let i be smallest index where c v and c p differ set new c v = i (as bit string) || c v (i) until c v ∈ {0,1,2,...,5} (at most 6 colors) Stefan Schmid @ T-Labs, 2011
How does it work? Initially: each node has unique log(n)-bit ID = legal coloring (interpret ID as color => n colors) ... 111 ... Round 3, ... 001 etc. Idea: root should have label 0 (fixed) in each step: send ID to c v to all children; receive c p from parent and interpret as little-endian bit string: c p =c(k)...c(0) let i be smallest index where c v and c p differ set new c v = i (as bit string) || c v (i) until c v ∈ {0,1,2,...,5} (at most 6 colors) Stefan Schmid @ T-Labs, 2011
Recommend
More recommend