Proofs: Coloring chordal graphs
These are the human proofs of Coloring chordal graphs, at full length.
The chordal coloring algorithm is correct and optimal full
This proof shows: correctness, termination.
Let be a finite simple undirected graph. Maximum cardinality search visits the vertices one at a time and always visits next an unvisited vertex with the largest number of visited neighbors. Let be its visit order and the step at which is visited. For each , , and if it is not empty, is its element with the largest .
Termination is clear: maximum cardinality search makes steps, and lines L2 to L7 are loops over the vertices, their adjacency lists and the recorded requests. We prove that the answer is right.
Lemma 1 (the search property). If , and , then there is a vertex with , and .
Proof. Let be the set of vertices visited before . Then and . When was chosen, . The vertex is in but not in . If , then would contain and also , so it would be larger. So some has .
Lemma 2. If is chordal, then is a clique for every vertex .
Proof. Suppose some contains two non-adjacent vertices . We call a path good if , is an induced path of (no edges between its vertices besides ), and every inner vertex has a larger than both ends and . The path is good: , and . For a good path let . We show that every good path gives a good path with . This is impossible, since takes only finitely many values, so the lemma follows.
Let be good, and name its ends so that has the smaller time and the larger: . Let , the inner neighbor of . Then , , and because is induced and . Lemma 1 with , , gives a vertex with , and .
The vertex is not on : it is not , since ; it is not , since ; and it is not an inner vertex, since those have larger than .
Let ; then and . Suppose has two elements with no element of strictly between them and . Then is a cycle of length . It has no chord: is induced, and is not adjacent to . This contradicts chordality. So is a set of consecutive integers , and since , .
Let . It has at least 3 vertices, since . It is induced: its part is part of , and is adjacent to and to no with . Its inner vertices are . Each of them is an inner vertex of or equals , so its time is at least , which is larger than and larger than ; inner vertices of other than have time larger than . So is good, with the ends and , and .
Lemma 3 (the check of lines L2 to L5). Every is a clique if and only if, for every with , .
Proof. If is a clique, is adjacent to its other elements. Conversely, assume the condition, and show by induction on that is a clique. Let be in and . If one of them is , the condition gives . Otherwise both are adjacent to and have , by the choice of , so both lie in . As , the induction hypothesis says that is a clique, so .
Line L5 tests exactly the condition of Lemma 3: for each it marks and checks every recorded for , and the recorded pairs are for .
Lemma 4. If every is a clique, then is chordal.
Proof. Let be a cycle of length at least 4, and its vertex with the largest . The two neighbors of on have smaller times, so they lie in and are adjacent. They are not consecutive on , because has length at least 4, so this edge is a chord.
The answer NOT CHORDAL. If is chordal, Lemma 2 and Lemma 3 show that line L5 finds no failure. If line L5 finds no failure, Lemma 3 and Lemma 4 show that is chordal. So the algorithm returns NOT CHORDAL exactly when is not chordal.
The coloring. Assume is chordal, so each is a clique. Lines L6 and L7 color the vertices in the order , and when is colored, its colored neighbors are exactly . The colors of these vertices exclude at most values, so the smallest free value is at most , and it differs from the color of each vertex of . Every edge with has , so the coloring is proper. The set is a clique of size , so
A proper coloring uses at least colors, so the coloring uses exactly colors and is optimal.