Coluring K-Colorable Graphs

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Coluring k-colorable graphs

Avi Wigderson approximated algorithm

Amir Sabag, Daniel Rosenberg,Ori Darshan


june. 2022

1
1 introduction

in our class we proved that any 3-colorable graph can be colored by 3 n. this algorithm and
its prove is represented as Algorithm A of this article.
the next goal of the article is generalizing an algorithm (named B) to any k-colorable
graph. and its last goal is to find minimize the running to its last version Algorithm (named
C)
in our work we focus on Algorithm B represented by Wigderson which finds legal coloring
to any k-colorable graphs colors this graphs within. we prove for k-colorable graphs:
1
a. The algorithm use not more than (k + 1)n1− k colors.

b. Its running time is O(k(|V | + |E|)).

2
2 Facts
1. every graph is max degree+1 (∆(G)+1) colorable within polynomial time: greedy
algorithm which traversing over G and color each vertex with the lowest available legal
color will grant this result. (running time is O(|V | + |E|). [1]

2. 2-colorable graph: graph G is 2-colorable iff G is bipartite(G = (A ∪ B, E)) and its


coloring running time is polynomial.
proof:
→ if its 2-colorable graph we will take all verteces with color 1 to be group A and the
others to be group B, the verteces inside each group is independent so this graph is
bipartite.
← for bipartite graph we shall take the whole group A to be colored blue and the whole
group B to be red.
running time: split bipartite graph verteces to two independent groups will take O(|V |+
|E|). and once more set one group to color 1 and the another to color 2. □

3. Let G(V,E) be a 3-colorable graph. then for every v ∈ V (G) the subgraph of G induced
by N(v) is bipartite (2-colorable).
proof:
the neighbours of v cannot hold the color of v. since the graph is 3-colorable. v
neighbourhood left with 2 different colors left to be colored with. from Fact 2 we
done.□

4. Let G(V,E) be a (k+1)-colorable graph. then for every v ∈ V (G) the subgraph of G
induced by N(v) is k-colorable.
proof:
even if the whole neighborhood of v is a clique. its ∆(N (v)) = k − 1 and from ’Fact 1’
this subgraph is k-colorable. □

3
3 Algorithm B(k, G, i) description
we will use Fact 4 to recursibely use k-colorable graphs algorithm for (k+1)-colorable graphs.
Input: k, i ∈ N , a k-colorable graph G. the integer i, telling our current color which we
have to use.
Output: the number of colors used to color G.
Definition 1. The Algorithm steps:
1. if: k = 2, 2-color G [from Fact 2] with i, i+1 and return 2.
2. else (k > 2): n ← the number of vertices in G.
3. [Recursive coloring stage]: while ∆(G) ≥ fk (n) do:
(note: will find this function in the next section)
3.1 let v be a vertex with dG (v) = ∆(G).
3.2 H ← the subgraph of G induced by NG (v).
3.3 j ← Algorithm B(k-1, H, i) (note: H was colored with i, i=1, ..., i+j-1 colors).
3.4 color v with i+j.
3.5 G ← the subgraph of G resulting from it by deleting NG (v) ∪ v.
4. color G with colors i, i+1, ... , i+s-1, return s. (note: ∆(G) < fk (n))
(note: s < 1 + fk (n)) [from Fact 1]

3.1 choosing fk (n) as break even point


from the specific case of 3-colorable graphs we know that:
n √
f3 (n) = → f3 (n) = n
f3 (n)

and n is its break even point.
in general we get:
n
fk+1 (n) = fk (fk+1 (n))
fk+1 (n)
with base condition of f2 (n) = 1. we would like to hold an closed equality to fk+1 (n):
1
Lemma 1. for any integer k ≥ 2 : fk+1 (n) = n1− k
proof - by induction on k:
base: k=2. f2 (n) = n1−1 = 1
i.a: the lemma holds for k.
step: prove for k+1.
n 1 n
fk+1 (n) = fk (fk+1 (n)) = fk+1 (n)1− k →
fk+1 (n) fk+1 (n)
the right equality holds from i.a.
1 n 1 1
→ fk+1 (n)1+ k = → fk+1 (n)2+ k = n → fk+1 (n) = n1− k
fk+1 (n)
while the left and right equations holds from exponential rules. □

4
4 Correctness of Algorithm B and coluring upper bound
Theorem 1. for every G=(V,E) k-colorable and |V (G)| = n Algorithm B colors G with at
1
most: kfk (n) = kn1− k−1 .
Proof: We use induction on k.
base: k=2, coloring bipartite graphs with 2n0 = 2 colors.
i.a: the claim is true for all k-colorable graphs.
step: Let G be (k+1)-colorable graph with n vertices. Let m ∈ N be number of times step
3 of the Algorithm B was executed.

Case m=0: step 3 didnt happened at all, so we left with colors of only step 4 - fk+1 (n) + 1
so we got:
fk+1 (n) + 1 ≤ (k + 1)fk+1 (n)

Case m ≥ 1: Let i integer: 1 ≤ i ≤ m and define Hi the subgraph induced by NG (vi )(reminder:
step 3.2) at the i time of executing step 3 (in the outher while loop) from G.
Let ti := |V (Hi )| be the number of vertices in Hi . from i.a - every Hi has been colored
legally. each got different set of colors so there is no conflict between H components
colors.
and in the end of the algorithm step 4 has been executed once, and add not more than
fk+1 (n) + 1 colors.
Definition 2. concave function:

Let S be a convex region. then a function f : S → R is called concave if for every


x, y ∈ S and 0 ≤ λ ≤ 1 we have :
kf (x) + (1 − λ)f (y) ≤ f (λx + (1 − λ)y)
Lemma 2. jensen’s Inequality

Let f : S → R be a concave function, and let x1 , x2 , ..., xm be points in S, then:


Pm Pm
i=1 f (xi ) xi
≤ f ( i=1
m m
proof is via [2][3]
we will use the jensen inequality for this case proof.
first, we can use on our fk (n) function the jensen inequality because all its output
values is positive integers. (none negative real numbers).
now lets look on step 3. each subgraph Hi will be colored by not more than fk (ti ) =
1
kti 1− k colors, the equality holds from - ti is size of Hi and from i.a we just input ti to
the function.
also, since there is no components Hi , Hj that share the same vertex.
m
X m
X
|Hi | = ti ≤ n
i=1 i=1

5
and now, we can divide all sides with m and use f( k + 1) on all sides. and from the
jensen inequality we gain:
1 1
t ≥ n1− k → m < n k
while the right side is true because for any higher m, there would be contradiction to
the jensen inequality.

now we hold all our tools to be able to prove the whole recursive coloring of step 3:

m m Pm 1
1− k−1
1− 1 m X 1− k−1
1
i=1 ti
X
kti k−1 =k ti = km( )≤
i=1
m i=1 m
the left equation is just multiply by 1. the right equation is dividing each item in the
sum by m, we arrange the equation to feet the jensen inquality.
1 1
1− k−1
k−1 1
n 1− k−1
1
1− 1 n 1− k−1
1
1− 1
1
−1 1− k−1 k−2 1
≤ km( ) = km k−1 ( ) = k(nm k−1 m ) = k(nm k−1 )1− k−1
m m
1 1
= k(nm k−2 )1− k−1 <
where the left leq is from the jensen inquality and than fk is concave function. and the
other equations is just algebric rules of exponential and division.
1 −1 1 1
1 1 1+ k−1 + − 1
< k(n1+ k(k−2) )1− k−1 = kn1− k = kn k2 −2k (k−1)(k2 −2k) = kn1− k
1
while the left side is bigger than the equations from above because we proved: m < n k ,
the middle equation and the right is algebric development.
so to summerize this calculation of step 3 of the algorithm: the upper bound of the
1
colors amount is kn1− k .
1
at step 4 from Fact 4 the upper bound of the different colors used is 1 + n1− k .
1
so in total for this case, we used with not more than (k + 1)n1− k as required.
end of induction. proved the whole theorem. □

6
5 Running time analysis
Theorem 2. Algorithm B can be implemented to run in time O(k(|V | + |E|)) on k-colorable
graphs G(V,E).

proof:
our assumptions is that the data structure of the graph G which marked as our origin graph.
and with the next attributes: (pretty basic)

ˆ from each vertex, its takes a constant - O(1) to point to its adjacent verteces. (a.k.a
neighbours)

ˆ from each vertex, its take a constant - O(1) to point to its adjacent edges.

ˆ delete a vertex and its edges will take a constant time as well.

graph can be preprocessed to construct the data structure DEGREE. its purpose is to
maintain the degree of each vertex so that we can update it in constant time with each
removal of an edge, and have a constant time access to a vertex of maximum degree in the
graph. Let d1 ≥ d2 ≥ ... ≥ d (G) be the degree values accourding in the graph. Let i ∈ [∆]

for each di we keep a ”bucket” Di . these buckets are linked in the above order between each
other (head and tails), and we have a pointer to the first bucket, D1 . in each bucket Di we
keep all the vertices of degree di doubly linked in adding order.
Every Di to the first item of the structure so its would cost constant - O(1) to check if the
struct is-empty. each vertex in the graph G will point to its place in the appropriate bucket
in DEGREE. We can add or delete a vertex from a bucket in constant time. so the struct
DEGREE can be built from the origin graph G in O(|V | + |E|) time.

Finally, we hold list of Colors of the vertices, which will be global to all levels of the
recursion. we have k-1 levels in the recursion, so to prove the time bound we have to show
that each level takes time of O(|V | + |E|). ||
Assume that the input to the current level of recursion is a k-colorable graph G(V,E).
given in graph G.

case k=2 from Fact 2 - G can be 2-colored in linear time.

case k > 2 construct DEGREE(G). Let v be a vertex of maximum degree - deg(v) = ∆(G).
if we are in the recursive coloring stage, we wish to construct graph H for the graph H
induced by NG (v), and update graph G and DEGREE(G) to contain the new graph G
resulting from the deletion of N (v) ∪ v.
to do that we first remove N (v) from graph G, leaving these vertices linked to form
graph G. then we scan the adjacency list of each vertex u ∈ N (v).
For each vertex w ∈ / N (v) in u adjacency list and do the following:

a. delete w from u adjacency list.


b. delete u from w adjacency list.
c. decrement deg(w) by 1 in DEGREE(G).

7
d. delete v and N(v) from DEGREE(G).

note: we spend constant time of each edge and vertex before they are deleted from the
graph.
in the end of all this process. at each level of the recursion, each vertex and edge can
instance at only one subgraph H. also, the operations a,b,c,d costs constant time.
the total running time for specific recursion level is the running time to build all the
subgraphs H at that level - multiply by constant (operations on DEGREE, verteces
and edges) → running time of each spesific recursion level is O(|V | + |E|)

the coloring of step 4 will be done in linear time as mentioned in the start of our article.
Therefore the time used in each level of recursion is O(|V | + |E|).

also we proved there is k-1 recursion levels so we got: the total running time which
combined from step 3 and 4 running time is O(k(|V | + |E|)) as claimed. □

8
6 Summary and conclusions
we improved an algorithm to color 3-colorable graphs to a general algorithm which will work
for any k-colorable graph. in our classes we studied the brooks theorem which grants an
algorithm to color any graph that doesnt a clique or odd cycle with ∆(G) colors.
1
but here, we studied from Avi wigderson an algorithm to color any graph with kn1− k colors
which k its his chromatic number. and polynomial running time! O(k(|V | + |E|))

the pros of this algorithm is its beneficial to low k in compare to the size of |V (G)| = n. but
the cons is: if the ratio between k and n is not exponential(i.e n = 2k , we suspect about the
relevancy of this algorithm to be useful.

at the article of Wigderson, there is also represented Algorithm named C, which grants same
results as Algorithm B but with smaller running time. but we wont expand on that.

9
References
[1] greedy coloring algorithm (∆(G) + 1 colors) and brooks theorem (click here) writen by
Elad Aigner-Horev.

[2] jensen inquality proof from stanford uni book.(click here) pages 77 to 79.

[3] jensen inquality from wikipedia (in case the above link wont work).(click here) pages 77
to 79.

10

You might also like