Coloring as an Assignment to Vertices
A vertex coloring assigns a color label to each vertex. The central restriction in a proper coloring is local: the endpoints of every edge must receive different labels. This way of describing a coloring makes it possible to translate between individual assignments and groups of vertices that can share a color.
Throughout, graphs are finite and simple: they have no loops or multiple edges. A set \(I\subseteq V(G)\) is independent if no two distinct vertices in \(I\) are adjacent. A partition of \(V(G)\) is a collection of pairwise disjoint, nonempty subsets whose union is \(V(G)\). For the empty vertex set, the empty collection is its partition.
The set \(C\) is the palette, or the set of available labels. A coloring can have labels in its palette that it does not use. In this tutorial, a coloring with a palette of \(k\) labels means a proper assignment into that palette; it need not use every label. When every label is used, we say explicitly that the coloring uses exactly \(k\) colors.
Color labels are names, not mathematical values that affect adjacency. For example, replacing every occurrence of red by circle and every occurrence of blue by triangle preserves whether the assignment is proper. The labels themselves may be numbers, words, symbols, or any other distinct objects.
From Color Classes to Independent Sets
Proof. First suppose \(c:V\to C\) is a proper coloring, and let \(S=c(V)\) be the set of labels it actually uses. For each \(x\in S\), the class \(c^{-1}(x)\) is nonempty by the definition of \(S\). Every vertex belongs to the class of its assigned label, so the classes have union \(V\). If a vertex belonged to both \(c^{-1}(x)\) and \(c^{-1}(y)\), then its assigned label would equal both \(x\) and \(y\), which gives \(x=y\). Thus distinct classes are disjoint. If an edge had both endpoints in \(c^{-1}(x)\), its endpoints would receive the same label \(x\), contradicting properness. Each class is therefore independent, and the nonempty classes form a partition. Their number is \(|S|\), the number of colors used.
Conversely, suppose \(\{I_1,\dots,I_r\}\) is a partition of \(V\) into independent sets, and choose distinct labels \(x_1,\dots,x_r\). Assign label \(x_i\) to every vertex in \(I_i\). Every vertex lies in exactly one part, so this defines an assignment on all of \(V\). For any edge \(uv\), its endpoints cannot lie in the same part, because each part is independent. They therefore receive different labels, so the assignment is proper. Each part is nonempty, so each of the \(r\) labels is used. If \(V=\varnothing\), the unique assignment from \(V\) has no used labels, and the corresponding partition is the empty partition; this is the \(r=0\) case. \(\square\)
This correspondence gives two equivalent ways to describe the same structure. A coloring lists the label assigned to each vertex. Its color classes group together exactly the vertices with equal labels. Conversely, a partition specifies which vertices share a label; choosing names for the parts turns it into an assignment.
Worked Examples
Worked Example: Reading the Classes of a Coloring
Let \(G=(V,E)\) have \(V=\{1,2,3,4\}\) and \(E=\{12,23,34\}\). Use the palette \(C=\{\text{red},\text{blue}\}\), with assignments \(c(1)=\text{red}\), \(c(2)=\text{blue}\), \(c(3)=\text{red}\), and \(c(4)=\text{blue}\). Find the color classes and decide whether the assignment is proper.
The red class is \(c^{-1}(\text{red})=\{1,3\}\), and the blue class is \(c^{-1}(\text{blue})=\{2,4\}\). Check every edge: edge \(12\) has endpoint labels red and blue; edge \(23\) has labels blue and red; edge \(34\) has labels red and blue. Thus each edge has endpoints with different labels, so the assignment is proper.
The classes are disjoint, nonempty, and together contain all four vertices. They are independent: \(12,23,34\) are all the edges, and none has both endpoints in \(\{1,3\}\) or both in \(\{2,4\}\). Conversely, assigning red to \(\{1,3\}\) and blue to \(\{2,4\}\) recovers the given assignment.
Check: the assignment is proper exactly when each of the three listed edges crosses between the two classes; the edge-by-edge check confirms that all three do.
Worked Example: A Partition Gives a Coloring
Let \(G=(V,E)\) have \(V=\{a,b,c,d,e\}\) and \(E=\{ab,ac,de\}\). Consider the collection of sets \(I_1=\{a,d\}\) and \(I_2=\{b,c,e\}\). Determine whether this is a partition into independent sets, and, if it is, give the corresponding color assignment.
The sets are nonempty and disjoint, and their union is \(\{a,b,c,d,e\}\), so they partition \(V\). To check independence, inspect the edges. Edge \(ab\) has one endpoint in \(I_1\) and one in \(I_2\); edge \(ac\) also has one endpoint in each; edge \(de\) has one endpoint in each. None has both endpoints in \(I_1\), and none has both endpoints in \(I_2\). Both parts are independent.
Assign red to every vertex of \(I_1\) and blue to every vertex of \(I_2\). The assignments are \(c(a)=c(d)=\text{red}\) and \(c(b)=c(c)=c(e)=\text{blue}\). The edge labels are red-blue on \(ab\), red-blue on \(ac\), and red-blue on \(de\); hence the coloring is proper and uses exactly two colors.
Check: every vertex receives a label because the two sets cover \(V\), and no edge has equal labels at its endpoints because each of the three edges crosses between the sets.
Worked Example: Available Colors Versus Used Colors
Let \(G=(V,E)\) have \(V=\{p,q,r,s\}\) and \(E=\{pq,rs\}\). Use the palette \(C=\{\text{red},\text{blue},\text{green},\text{gold}\}\), with \(p,r\) assigned red and \(q,s\) assigned blue. Find all four classes and check the coloring.
The classes are \(c^{-1}(\text{red})=\{p,r\}\), \(c^{-1}(\text{blue})=\{q,s\}\), \(c^{-1}(\text{green})=\varnothing\), and \(c^{-1}(\text{gold})=\varnothing\). Only red and blue are used. The nonempty classes \(\{p,r\}\) and \(\{q,s\}\) are disjoint and have union \(V\). Edge \(pq\) has labels red and blue, and edge \(rs\) has labels red and blue, so the assignment is proper.
The two empty classes are not parts of the partition: a part must be nonempty. Thus this assignment has a palette of four labels but uses exactly two colors. If the same vertices are assigned the same labels and green and gold are removed from the palette, the assignment and its nonempty color classes are unchanged.
Check: the only edges are \(pq\) and \(rs\), and both have endpoints assigned different labels. No condition requires every available label to occur.
Labels, Classes, and the Empty Case
Proof. Let \(c:V\to C\) be an assignment, and let \(\pi\) be a one-to-one map on its used labels. Define the renamed assignment by \(c'(v)=\pi(c(v))\). For any used label \(x\), a vertex \(v\) has \(c'(v)=\pi(x)\) exactly when \(\pi(c(v))=\pi(x)\). Since \(\pi\) is one-to-one, this holds exactly when \(c(v)=x\). Therefore the class for \(\pi(x)\) under \(c'\) is the class for \(x\) under \(c\). Also, for any vertices \(u,v\), \(c(u)=c(v)\) if and only if \(\pi(c(u))=\pi(c(v))\). Thus endpoints of an edge receive different labels under \(c\) exactly when they do under \(c'\). The two assignments have the same classes and the same properness status. \(\square\)
When \(V=\varnothing\), there is exactly one function from \(V\) to any palette: the empty function. It is proper because there are no edges whose endpoint labels could violate the condition. It has no used colors and no nonempty color classes. For a nonempty graph, every assignment uses at least one color, because every vertex is assigned a label. These cases explain why the number of labels in the palette and the number of nonempty classes are different quantities.
Common Pitfall: Checking Only Some Edges
A proposed assignment is not proper merely because most edges have differently colored endpoints. For example, let \(H=(V,E)\) have \(V=\{x,y,z\}\) and \(E=\{xy,yz,zx\}\). Assign red to \(x\), red to \(y\), and blue to \(z\). A mistaken check might inspect only \(yz\) and \(zx\), observe that both edges have different endpoint labels, and call the coloring proper. But edge \(xy\) has red at both endpoints. The red class \(\{x,y\}\) is not independent, so the assignment is not proper. The correction is to check every edge, or equivalently to verify that every color class is independent.
The partition viewpoint is often convenient when the groups of vertices are already known. The assignment viewpoint is convenient when each vertex has been given a label. To move between them, take the nonempty inverse images of the labels; empty classes are discarded because partitions contain only nonempty parts. This correspondence describes proper colorings without making any claim that a coloring uses the fewest possible colors.
Check Your Understanding
For each question, state the color classes or test independence directly from the given edges.
- Let \(G\) have \(V=\{1,2,3,4\}\), \(E=\{12,23,34\}\), and assignments \(c(1)=c(3)=\text{green}\), \(c(2)=c(4)=\text{orange}\). List the color classes and verify properness.
- Let \(G\) have \(V=\{a,b,c,d\}\), \(E=\{ab,bc,cd\}\). Is \(\{\{a,c\},\{b,d\}\}\) a partition into independent sets? Give the associated assignment if it is.
- A palette has five labels, but a coloring has three nonempty color classes. How many colors does it use, and how many of its palette labels have empty classes?
- Explain why an empty color class is not a part of a partition, even though it is the inverse image of an available label.
- For the empty graph with \(V=\varnothing\), how many vertices receive labels, and how many nonempty color classes does its unique assignment have?