The problem

Color the nodes of a graph using a fixed color palette, so that no two neighboring nodes have the same color.

Lemma. Any graph in which the maximum degree of a node is D can be colored using (D+1) colors.

But it is a bit silly (or at least an overkill) to use five colors to color the nodes of the above star graph, when only two colors are enough. Conversion into dag often helps

How?

Lemma. Any graph in which the maximum out-degree of a node is D can be colored using (D+1) colors.

Six-coloring a

Make sure you know what a planar graph is.

We will transform the planar graph G = (V, E) into a dag, in which no node has an out-degree greater than five. How? (Euler’s polyhedron formula) e ≤ 3p –6 (e = |E|, p = |V|)

Lemma. Every planar graph has at least one node with degree five or less.

Each node with degree ≤ 5 will make all its edges “outgoing”. The remainder graph is also a planar graph, so the process can be recursively applied, until all edges are directed. This results in the desired dag.

So six-coloring is clearly feasible. But how will the distributed algorithm work?

Each node executes the following: do no. of undirected edges £5 Æ make all such edges outgoing od

But the coloring algorithm need not wait for the completion of this phase! program planar graph coloring;

{program for node i} do outdegree(i) £ 5 Ÿ $j e succ(i) : c[i] = c[j] Æ c[i] := b : b e {S \ sc(i)} number of undirected edges £ 5 Æ make all undirected edges outgoing od Minimum Weight Spanning

For a graph, the MST is a spanning tree for which the sum of the weights of the tree edges is the smallest. Well- known sequential algorithms are

(1) Prim’s algorithm and

(2) Kruskal’s algorithm.

These algorithms build the MST by adding one node at a time. Review how they work.

Lemma. If the weight of every edge is distinct, then the MST is unique.

Why? Gallagher, Humblet, Spira’s (GHS) algorithm

Distributed version of Kruskal’s – uses message passing

8 0 2 e 1 5

1 4 5 7 T2 T1 3

4 6 3 6 2 9

Strategy: Divide and Conquer

Assume that MST T1 covers the vertices V1 and T2 covers the vertices V2. Let e be an edge of minimum weight joining T1 and T2. Then T1 » T2 » e is the MST covering the nodes in V1 » V2. Problems and solutions

Challenge 1. How will the nodes in a given fragment identify the edge to be used for connecting to a different fragment?

Answer. Need a coordinator for each fragment. Initially, it can be the node with the largest or smallest id. Later, after each merger, the node with the largest or smallest id across a (called core edge) becomes the leader.

Challenge 2. How will a node in T1 determine if a given edge connects to a node of a different tree T2 or the same tree T1?

Answer. Assign a unique name to all nodes in a fragment. The major steps in MST construction

The construction progresses in levels. There are two steps:

Merge. Two fragments in level L merge into one fragment in level L+1. The new fragment is named after the edge that joined the two fragments.

Absorb. A fragment at level L is absorbed by another fragment at level L+1.

(join, L, T)

T T’ (join, L’, T’) level=L level = L’

(a) L= L’

T (join, L’, T;) T’

level = L’ level=L

(b) L > L’ The goal is to construct the MST in at most log N levels.

Each fragment is a rooted tree. The root is the node on which the least weight outgoing edge is incident.

Initiate (finding lwoe) root

Report used to determine lwoe

To test if an edge is outgoing (connecting to a different fragment, a node i sends out a test message to node j:

® name(i) = name (j) ‡ send accept

® name (i)≠name (j) Ÿ level(i) £ level(j) ‡ send reject

® name (i) ≠ name (j) Ÿ level (i) > level (j) ‡

wait until level (j) = level (i)

Who knows - node j may be in the process of merging with node i’s fragment! But j’s level can never decrease. (Make sure that the waiting time is finite). From all the “accept” reports, the root picks the lwoe. Now, the current root broadcasts a changeroot message to let all processes in its fragment about the new root who will negotiate the merger.

The root sends a join message through the lwoe.

Note. An edge can be basic, rejected or branch (i.e. a tree edge). Initially all edges are basic. The attributes reject and branch are stable. So test messages are sent through basic edges only.

An edge changes its status from basic to branch, when the join message is accepted.

Finally all nodes in the combined fragment must know the new root. This is done via the changeroot message. The final algorithm: outline

The root node executes the following steps until no outgoing edges are found.

Find lwoe; send changeroot message in the local fragment; The root i sends (join, level(i), name(i)) to j via lwoe (i,j);

MERGE (join, level(j) name(j)) rec’d from j and level(i) = level(j)’ change the status of (i,j) from basic to branch; broadcast (initiate, name = w(i,j), level := level(i) +1) in the fragment;

ABSORB (join, level(k), name(k)) rec’d from k and level(i) >level(k)’ change the status of (i,k) from basic to branch; broadcast (initiate, name = w(i,k), level = L’) to the fragment of k; od MERGE 0 2 MERGE 1 5

1 4 5 7 3

6 4 3 2 6 MERGE 9 (a)

8 0 2 1 5

1 4 5 7 MERGE 3 6 4 ABSORB 3 2 6 9

(b)

8 0 2 1 ABSORB 5

1 4 5 7 3 6 4 3 2 6 9

(c)