Graph coloring is a technique used in graph theory to assign labels (called colors) to the vertices or edges of a graph, subject to certain constraints. The main idea is to ensure that no two adjacent vertices (or edges, in the case of edge coloring) share the same color. Graph coloring has applications in various fields such as scheduling, map coloring, frequency assignment, and register allocation in compilers.
In vertex coloring, the goal is to assign colors to the vertices of a graph such that no two adjacent vertices (vertices that are connected by an edge) share the same color.
Proper Coloring: A coloring is considered proper if no two adjacent vertices share the same color. In other words, for any edge in the graph, the color assigned to must be different from the color assigned to .
Chromatic Number: The chromatic number of a graph is the smallest number of colors needed to color the graph properly. This is the minimum number of colors required to color the vertices of the graph such that no two adjacent vertices share the same color.
For example, the chromatic number of a triangle (a graph with three vertices, all connected to each other) is 3 because we need three colors to color all three vertices.
For a complete graph with vertices, the chromatic number is , because all the vertices are adjacent to each other and require a unique color.
In edge coloring, the goal is to assign colors to the edges of a graph such that no two edges that share a common vertex have the same color.
Proper Edge Coloring: A coloring is proper if no two edges that meet at a vertex (i.e., have a common endpoint) share the same color.
Chromatic Index: The chromatic index of a graph , denoted as , is the smallest number of colors required to color the edges of the graph such that no two edges incident to the same vertex have the same color.
For complete bipartite graphs , the chromatic index is either or , where is the maximum degree of any vertex in the graph.
For general graphs, finding the chromatic index is often a difficult problem.
Different types of graphs have different chromatic numbers. Some important relationships between graph classes and their chromatic numbers are as follows:
Complete Graphs : The chromatic number of a complete graph with vertices is , since every pair of vertices is adjacent and requires a unique color.
Bipartite Graphs: A bipartite graph (a graph whose vertices can be divided into two sets such that no two vertices in the same set are adjacent) can always be colored with 2 colors, meaning the chromatic number of any bipartite graph is 2.
Planar Graphs: The Four Color Theorem states that any planar graph (a graph that can be drawn in a plane without edges crossing) can be colored using no more than 4 colors. Thus, the chromatic number of any planar graph is at most 4.
Trees: The chromatic number of any tree is 2 (i.e., a tree is always 2-colorable), because a tree is a bipartite graph (it has no cycles of odd length).
Graph coloring has various practical applications across different fields:
Scheduling: Graph coloring is used to model scheduling problems, where each task is represented by a vertex and edges indicate conflicts (e.g., two tasks that cannot be performed at the same time). The goal is to assign colors to the tasks such that no two conflicting tasks share the same time slot (color).
Map Coloring: In map coloring, each region of a map is represented by a vertex, and edges represent shared borders between regions. The goal is to color the regions using as few colors as possible such that adjacent regions (i.e., regions that share a border) have different colors. The Four Color Theorem guarantees that no more than four colors are needed for any map.
Frequency Assignment: In wireless communication, graph coloring is used to assign frequencies to transmitters such that no two transmitters that are too close to each other (i.e., their signals might interfere) are assigned the same frequency.
Register Allocation: In computer science, particularly in compiler optimization, graph coloring is used to allocate registers to variables in such a way that variables that are used simultaneously do not share the same register.
There are several algorithms designed to find the chromatic number or to color a graph:
Greedy Coloring Algorithm: A simple heuristic approach for vertex coloring is the greedy coloring algorithm, which colors the vertices one by one. For each vertex, the algorithm chooses the smallest available color that has not been assigned to its adjacent vertices. This algorithm does not always give the optimal (minimal) coloring, but it often provides a good approximation.
Backtracking: Backtracking algorithms can be used to find the chromatic number by trying different color assignments and backtracking when a conflict occurs (i.e., when two adjacent vertices end up with the same color).
Exact Algorithms: Exact algorithms, such as branch and bound, attempt to find the optimal chromatic number by exploring all possible color assignments, though they are computationally expensive.
Graph coloring is an NP-hard problem, meaning that there is no known efficient algorithm that can solve all graph coloring problems in polynomial time. Finding the chromatic number of a general graph or solving a graph coloring problem optimally is computationally difficult as the size of the graph grows. Therefore, heuristics and approximation algorithms are often used for larger, real-world graphs.
Vertex Coloring: Assigning colors to vertices such that no two adjacent vertices have the same color.
Edge Coloring: Assigning colors to edges such that no two edges incident on the same vertex share the same color.
Four Color Theorem: Any planar graph can be colored with no more than 4 colors.
Applications: Graph coloring is used in scheduling, map coloring, frequency assignment, and register allocation.
Algorithms: Greedy coloring, backtracking, and exact algorithms are used to find graph colorings, with greedy algorithms being the most common approach due to their simplicity.
Open this section to load past papers