Download - Vertex Coloring Distributed Algorithms for Multi-Agent Networks Instructor: K. Sinan YILDIRIM
Vertex Coloring
Distributed Algorithms for Multi-Agent Networks
Instructor: K. Sinan YILDIRIM
Symmetry-breaking • Symmetry-breaking
– Prohibit certain processor pairs, e.g. neighboring processors, from operating simultaneously. • efficiently schedule processor groups• Can be formalized as a vertex coloring or maximal independent
set (MIS) problem.
• Difficult to "break" the symmetry – All processors may be a priori alike– In many cases, they may start the computation from the same initial
state and execute the same local protocol. • In other words, the "view" of the system from the various
processors may be symmetric.
Vertex (Node) Coloring Problem
• Given an undirected graph G = (V,E) assign a color cu to each vertex u in V such that the following holds: – e = (v,w) in E implies that cv≠cw .
• The application often asks us to use few colors!– In a TDMA MAC protocol, for example, less colors
immediately imply higher throughput.• Ware often happy with a solution which is suboptimal.
– There is a tradeoff between • the optimality of a solution• the work/time needed to compute the solution
Assumptions & Definitions
• Each node has a unique identier, e.g., its IP address. – each identier consists of only log n bits if the system has n
nodes.
• The chromatic number Χ(G) – Given an undirected Graph G = (V,E), the chromatic
number of G is the minimum number of colors to solve vertex coloring problem.
A Greedy Algorithm (Centralized)
The algorithm is correct and terminates in n steps. The algorithm uses at most Δ+1 colors such that Δ denotes the maximum degree in a graph G.
PROOF: Since each node has at most Δ neighbors, there is always at least one color free in the range {1,…, Δ+1}.
1: while there exists uncolored vertex v do2: color v with the minimal color (number) that does not conflict with the already colored neighbors3: end while
Synchronous Distributed Algorithm
• Nodes operate in synchronous rounds. • In each round, each processor executes the following steps:
– Receive messages that were sent by neighbors– Do some local computation of reasonable complexity
• do very simple computations (a comparison, an addition,• Exponential-time computation is usually considered cheating in this
context.– Send messages to neighbors in graph of reasonable size
• Sending a message with a node ID, or a value is considered okay• Sending really long messages is considered cheating.
A Simple Synchronous Algorithm
1
2
3
4
5 6
1
2
3
4
5 6
1
2
3
4
5 6
2
3
4
5 6
1
2
3
4
5
1
6
2
3
4
5 6
1
THEOREM: This algorithm is correct and terminates in n steps. The algorithm uses at most Δ+1 colors such that Δ denotes the maximum degree in a graph G.
1: Assume that initially all nodes have IDs2: Each node v executes the following code3: node v sends its ID to all neighbors4: node v receives IDs of neighbors5: while node v has an uncolored neighbor with higher ID do6: node v sends “undecided" to all neighbors7: node v receives new decisions from neighbors8: end while9: node v chooses a free color 10: node v informs all its neighbors about its choice
Asynchronously Coloring Trees
• Theorem: Χ(Tree)≤2– If the distance of a node to the root is odd (even), color it 1 (0).
THEOREM: Algorithm is correct. If each node knows its parent and its children, the (asynchronous) time complexity is the tree height which is bounded by the diameter of the tree; the message complexity is |E|.
1: Color the root 0, root sends 0 to its children2: Each node v concurrently executes the following code:3: if node v receives a message x (from parent) then4: node v chooses color cv = 1 - x5: node v sends cv to its children (all neighbors except parent)6: end if
Log-Star
• Log*
– For all x ≤ 2: log*x = 1 – For all x > 2: log*x = 1 + log*(log x)
• Log-star is an amazingly slowly growing function. – Log-star of all the atoms in the observable universe
(estimated to be 1080) is:• Log*1080 = 1 + log*(80) = 2 + log*(1,…) = 3.
• So log-star increases indeed very slowly!
6-Coloring Trees
0010110000
1010010000
0110010000
10010
01010
10001
…
111
001
1: Assume that initially the vertices are legally colored (each label only has log n bits)2: The root assigns itself the label 0.3: Each other node v executes the following code (synchronously in parallel)4: send cv to all children5: repeat6: receive cp from parent7: interpret cv and cp as little-endian bit-strings: c(k);…; c(1); c(0)8: let i be the smallest index where cv and cp differ9: the new label is i (as bitstring) followed by the bit cv(i) itself10: send cv to all children11: until cw in {0,…,5} for all nodes w
How it works• Since initially all nodes have different IDs
– The new color value of it will be, for sure, different from its parent and its children» CASE 1:The position of the bit that a node’s color differ from its parent
and its children are different» CASE2: The position of the bit that a node’s color differ from its parent
and its children are the same, but the appended bit is different!
• For example: if you have 7-bit identifiers initially– In the first round, the bit position that is different may be the 6th position
• The new identifiers should be 4-bits, something like 110X, 101X, 100X,011X,010X,001X,000X
– In the second round, the bit position that is different may be the 3rd position• The new identifiers should be 3-bits, something like 11X, 10X, 01X,00X
– In the last round, the bit position that is different may be the 2nd position• The new identifiers should be 3-bits, something like 10X, 01X,00X
0000
0001
0010 0011
Analysis
• Colors 11* (in binary notation, i.e., 6 or 7 in decimal notation) will not be chosen– Because the node will then do another round.
• E.g., 011 and 111 differ at position 2 that will give 101
– Colors in the range 0,…,5 always forms colors in this range • This gives a total of 6 colors (i.e., colors 0,. . . , 5).
• THEOREM: Algorithm terminates in log*n time.– If we have n nodes, we need log n bit for identifiers.
• First round: We get at most logn+1 bit string.• Second round: We get log(logn+1) + 1 bit string. • …• Until we have all colors in {0,…,5}
Six-to-Three Algorithm1: Each node v concurrently executes the following code:2: Run 6-Coloring for log* n rounds.3: for x = 5, 4, 3 do4: Perform subroutine Shift Down 5: if cv = x then6: choose new color cv in {0,1,2}7: end if8: end for
1: Root chooses a new (different) color from {0,1,2}2: Each other node v concurrently executes the following code:3: Recolor v with the color of parent
Colors: {Red, Green, Blue, Yellow, Orange, Purple}
THEOREM: Algorithm terminates in log*n time and colors a tree with three colors.
Shift-down ensures that all children are monochromatic. Hence, the any node v that has cv = x can choose a color in {0,1,2}!