150 likes | 185 Views
Explore Brook’s Theorem, Sequential & Max Color-Degree Coloring Algorithms for graph coloring, and Prufer Codes for tree coding. Learn Hamming Distance theory for binary addressing of trees.
E N D
Introduction to Graph Theory Lecture 18: Graph Coloring Algorithms and Tree Codes
Graph Coloring Algorithms • Brook’s Theorem: If G is a connected graph and is neither complete nor an odd cycle, then . • But could be much greater than . • In the textbook, it discusses two approximation algorithms • Sequential coloring • Maximum Color-Degree Coloring
Sequential Coloring • Assumptions: • Vertices are labeled and vertex labels are colored • Possible colors are also ordered from lowest to highest. • Algorithm • Color the first vertex by 1 • Color each subsequent vertex by the lowest color not used by any of its neighbors that have already been colored
Example e a d b g a f g h c h b f c d e (A) (B) Different labeling results in different n-coloring
Maximum Color-Degree Coloring • Ideas: • Try to color vertices of high degree early • Simultaneously try to color a vertex whose neighbors have already received many distinct colors. • Color degree (cd) of v: is the number of distinct colors that have been assigned to neighbors of v.
Algorithm • Initialization • The Algorithm starts with a list U containing sorted, but uncolored, vertices of descending degree. • Color the 1st vertex v of U by 1 • i=1//keeps track of # of colored vertices • Delete v from U • Do the following until i=N //N=V(G)
(cont) • Select a vertex w from U with max cd and appears earliest on U • J=1; found=false; • While !found do • If some has color j then j=j+1 • Else • found=true • color w by j • i=i+1 //another vertex has been colored • remove w from U
Example e d k c f i j g h a b
Tree Coding • Here we deal with 2 problems: • Assigning a code to a tree that uniquely describes the tree • Addressing, i.e. label each vertex with a binary vector, so that the distance between two vertices can be ascertained directly from their labels.
Prufer Codes • Let V(T)={1,2,…,n} ( a labeled tree) • The Prufer code is an ordered (n-2)-tuple of integers with • T can be reconstructed from the Prufer code. • is reconstructed with another set of code • But reconstruction takes only
Constructing • Repeat the following steps until the labeled tree T becomes K2 • Let be the end vertex with the smallest label. • Let be the unique neighbor of . • Deleting vertex (and also edge ) from T, yielding a new tree T1 • T=T1
Example 7 1 3 4 5 2 6 8
Reconstructing Tree • Extend the sequence by setting • We first reconstruct • For each , is the smallest vertex not in and for • The edges of the tree are simply • Let’s reconstruct our previous example.
Binary Addressing of a Tree • Hamming distance: given two binary vectors, the number of bit positions that differ in the two vectors. • We want to assign each vertex a binary label, such that the distance between the vertices is the hamming distance. (0,1,0,0) (1,0,0,0) (0,0,1,0) (0,0,0,0) (0,0,0,1)
(cont) • Theorem 8.5: Let T be a nontrivial tree of order n. Then the vertices of T binary addressing using (n-1)-tuples. • The rest of the material is fairly easy to follow. So I’ll leave it as self-study. (We’ll work on one example if the time allows)