← 学习库 Discrete Mathematics (Levin) · 中英对照 目录

4.3 Coloring 染色

本页译自 LibreTexts · Discrete Mathematics (Levin) 第 4.3 章。公式经 MathJax 渲染,自定义宏已注入。

Mapmakers in the fictional land of Euleria have drawn the borders of the various dukedoms of the land. To make the map pretty, they wish to color each region. Adjacent regions must be colored differently, but it is perfectly fine to color two distant regions with the same color. What is the fewest colors the mapmakers can use and still accomplish this task?

在虚构的欧拉利亚(Euleria)王国,制图师们已绘出境内各个公国的边界。为了让地图美观,他们希望为每个区域上色。相邻区域必须染成不同颜色,但相距遥远的两个区域染成同色则完全无妨。制图师最少要用多少种颜色,才能完成这项任务?
image-112.svg

Perhaps the most famous graph theory problem is how to color maps.

或许图论中最著名的问题,便是如何为地图着色。

Given any map of countries, states, counties, etc., how many colors are needed to color each region on the map so that neighboring regions are colored differently?

给定任意一幅由国、州、县等区域构成的地图,要使相邻区域颜色不同,至少需要几种颜色来为地图上每个区域着色?

Actual map makers usually use around seven colors. For one thing, they require watery regions to be a specific color, and with a lot of colors it is easier to find a permissible coloring. We want to know whether there is a smaller palette that will work for any map.

实际制图师通常使用约七种颜色。一方面,他们要求水域用特定颜色;颜色多了,也更容易找到一种合法的着色方案。我们想知道,是否存在一个更小的调色板,能适用于任意地图。

How is this related to graph theory? Well, if we place a vertex in the center of each region (say in the capital of each state) and then connect two vertices if their states share a border, we get a graph. Coloring regions on the map corresponds to coloring the vertices of the graph. Since neighboring regions cannot be colored the same, our graph cannot have vertices colored the same when those vertices are adjacent.

这与图论有何关联?我们可以在每一区域的中心(比如每个州的首府)放置一个顶点,若两个州有共同边界,就在对应顶点之间连一条边,从而得到一个图。为地图上的区域着色,对应于为该图的顶点着色。由于相邻区域不能同色,当两个顶点相邻时,我们的图就不能让它们着相同颜色。

In general, given any graph $G\text{,}$ a coloring of the vertices is called (not surprisingly) a vertex coloring. If the vertex coloring has the property that adjacent vertices are colored differently, then the coloring is called proper. Every graph has a proper vertex coloring. For example, you could color every vertex with a different color. But often you can do better. The smallest number of colors needed to get a proper vertex coloring is called the chromatic number of the graph, written $\chi(G)\text{.}$

一般地,给定任意图 $G$,对顶点进行着色称为(毫不意外地)顶点着色。若一种顶点着色满足相邻顶点颜色互异,则称其为正常着色。每个图都有正常顶点着色——例如,你可以给每个顶点染不同颜色。但通常能做得更好。得到一种正常顶点着色所需的最少颜色数,称为该图的色数,记作 $\chi(G)$。

Example 1: chromatic numbers

示例 1:色数

Find the chromatic number of the graphs below.

求下列各图的色数。
image-113.svg image-114.svg image-115.svg

Solution

解答

The graph on the left is $K_6\text{.}$ The only way to properly color the graph is to give every vertex a different color (since every vertex is adjacent to every other vertex). Thus the chromatic number is 6.

左边的图是完全图 $K_6$。要正常地为它着色,唯一的办法是给每个顶点不同的颜色(因为每个顶点都与其余所有顶点相邻)。因此色数为 6。

The middle graph can be properly colored with just 3 colors (Red, Blue, and Green). For example:

中间的图只需 3 种颜色(红、蓝、绿)即可正常着色。例如:
image-116.svg

There is no way to color it with just two colors, since there are three vertices mutually adjacent (i.e., a triangle). Thus the chromatic number is 3.

不可能只用两种颜色为其着色,因为其中有三个顶点两两相邻(即一个三角形)。因此色数为 3。

The graph on the right is just $K_{2,3}\text{.}$ As with all bipartite graphs, this graph has chromatic number 2: color the vertices on the top row red and the vertices on the bottom row blue.

右边的图就是 $K_{2,3}$。与所有二分图一样,此图的色数为 2:把上一行的顶点染红,下一行的顶点染蓝。

It appears that there is no limit to how large chromatic numbers can get. It should not come as a surprise that $K_n$ has chromatic number $n\text{.}$ So how could there possibly be an answer to the original map coloring question? If the chromatic number of graph can be arbitrarily large, then it seems like there would be no upper bound to the number of colors needed for any map. But there is.

色数似乎可以任意大,看来不足为奇。完全图 $K_n$ 的色数为 $n$,这也不令人意外。那么,最初的地图着色问题怎么可能有答案呢?如果图的色数可以任意大,那么任意地图所需颜色数似乎就没有上界了。然而,事实并非如此。

The key observation is that while it is true that for any number $n\text{,}$ there is a graph with chromatic number $n\text{,}$ only some graphs arrive as representations of maps. If you convert a map to a graph, the edges between vertices correspond to borders between the countries. So you should be able to connect vertices in such a way where the edges do not cross. In other words, the graphs representing maps are all planar!

关键在于:尽管对任意数 $n$ 都存在一个色数为 $n$ 的图,但只有其中一部分图能表示地图。把地图转化为图时,顶点之间的边对应国家之间的边界。因此,连接顶点时应当能做到让边互不相交。换言之,表示地图的图全都是平面图!

So the question is, what is the largest chromatic number of any planar graph? The answer is the best known theorem of graph theory:

于是问题变为:任意平面图的色数最大是多少?答案便是图论中最著名的定理:

Theorem 1: The Four Color Theorem

定理 1:四色定理

If $G$ is a planar graph, then the chromatic number of $G$ is less than or equal to 4. Thus any map can be properly colored with 4 or fewer colors.

若 $G$ 是平面图,则 $G$ 的色数不超过 4。因此任意地图都能用 4 种或更少的颜色正常着色。

We will not prove this theorem. Really. Even though the theorem is easy to state and understand, the proof is not. In fact, there is currently no “easy” known proof of the theorem. The current best proof still requires powerful computers to check an unavoidable set of 633 reducible configurations. The idea is that every graph must contain one of these reducible configurations (this fact also needs to be checked by a computer) and that reducible configurations can, in fact, be colored in 4 or fewer colors.

我们不证明这一定理。真的。尽管该定理表述与理解都很容易,其证明却并不简单。事实上,目前尚无已知的「简单」证明。现有最佳证明仍需借助强大的计算机,去核查一个包含 633 个可约构型的不可避集。其基本思想是:每个图必含这些可约构型之一(这一事实同样需由计算机核查),而可约构型事实上可用 4 种或更少的颜色着色。

Coloring in General 一般着色

The math department plans to offer 10 classes next semester. Some classes cannot run at the same time (perhaps they are taught by the same professor, or are required for seniors).

数学系计划下学期开设 10 门课程。有些课程不能安排在同一时段(也许由同一位教授授课,或是高年级的必修课程)。
Class:Conflicts with:
AD I
BD I J
CE F I
DA B F
EH I
FI
GJ
HE I J
IA B C E F H
JB G H

中文说明:上表列出 10 门课程之间不能同时开课的时间冲突关系。若两门课程出现在彼此的「冲突课程(Conflicts with)」一栏中,则它们不能安排在同一时段。把每门课程看作一个顶点、冲突关系看作边,就得到一个图;求最少所需时段数,等价于求该图的色数(染同色的顶点可同属一个时段)。

课程冲突课程
AD I
BD I J
CE F I
DA B F
EH I
FI
GJ
HE I J
IA B C E F H
JB G H

How many different time slots are needed to teach these classes (and which should be taught at the same time)? More importantly, how could we use graph coloring to answer this question?

开设这些课程需要安排多少个不同的时段(哪些课程可安排在同一时段)?更重要的是,我们如何用图着色来回答这个问题?

Cartography is certainly not the only application of graph coloring. There are plenty of situations in which you might wish partition the objects in question so that related objects are not in the same set. For example, you might wish to store chemicals safely. To avoid explosions, certain pairs of chemicals should not be stored in the same room. By coloring a graph (with vertices representing chemicals and edges representing potential negative interactions), you can determine the smallest number of rooms needed to store the chemicals.

制图当然不是图着色的唯一应用。在很多情境中,我们都希望把研究对象分组,使相关的对象不落入同一集合。例如,你可能希望安全地存放化学品。为避免爆炸,某些化学品对不应贮存在同一房间。通过对图着色(顶点表示化学品,边表示潜在的负面相互作用),就能确定存放这些化学品所需的最少房间数。

Here is a further example:

再看一个例子:

Example 3

示例 3

Radio stations broadcast their signal at certain frequencies. However, there are a limited number of frequencies to choose from, so nationwide many stations use the same frequency. This works because the stations are far enough apart that their signals will not interfere; no one radio could pick them up at the same time.

广播电台以特定频率发射信号。然而可选频率数量有限,因此全国范围内许多电台使用相同频率。这之所以可行,是因为这些电台相距足够远,信号不会相互干扰——没有哪台收音机能同时接收到它们。

Suppose 10 new radio stations are to be set up in a currently unpopulated (by radio stations) region. The radio stations that are close enough to each other to cause interference are recorded in the table below. What is the fewest number of frequencies the stations could use.

假设要在一片目前尚无电台(无人居住)的区域新建 10 座电台。下表记录了那些彼此足够接近、会产生干扰的电台。这些电台最少需要几种频率?
image-117.svg

Solution

解答

Represent the problem as a graph with vertices as the stations and edges when two stations are close enough to cause interference. We are looking for the chromatic number of the graph. Vertices that are colored identically represent stations that can have the same frequency.

把该问题表示成一个图:以电台为顶点,当两座电台足够接近会产生干扰时连一条边。我们要求的就是这个图的色数。染成相同颜色的两个顶点,代表可以使用相同频率的电台。
image-118.svg image-119.svg

This graph has chromatic number 5. A proper 5-coloring is shown on the right. Notice that the graph contains a copy of the complete graph $K_5$ so no fewer than 5 colors can be used.

此图的色数为 5。右侧展示了一种正常的 5 着色。注意该图包含一个完全图 $K_5$ 的拷贝,因此至少要用 5 种颜色。

In the example above, the chromatic number was 5, but this is not a counterexample to the Four Color Theorem, since the graph representing the radio stations is not planar. It would be nice to have some quick way to find the chromatic number of a (possibly non-planar) graph. It turns out nobody knows whether an efficient algorithm for computing chromatic numbers exists.

在上例中色数为 5,但这并不是四色定理的反例,因为表示电台的这个图不是平面图。若能有一种快捷方法求出(可能非平面的)图的色数,那将十分理想。但事实上,是否存在计算色数的高效算法,至今无人知晓。

While we might not be able to find the exact chromatic number of graph easily, we can often give a reasonable range for the chromatic number. In other words, we can give upper and lower bounds for chromatic number.

虽然我们未必能轻易求出图的精确色数,却往往能给出色数的合理范围,换言之,给出色数的上界与下界。

This is actually not very difficult: for every graph $G\text{,}$ the chromatic number of $G$ is at least 1 and at most the number of vertices of $G\text{.}$

这其实并不难:对每个图 $G$,其色数至少为 1,至多为 $G$ 的顶点数。

What? You want better bounds on the chromatic number? Well you are in luck.

什么?你还想要更好的色数界?那你就找对地方了。

A clique in a graph is a set of vertices all of which are pairwise adjacent. In other words, a clique of size $n$ is just a copy of the complete graph $K_n\text{.}$ We define the clique number of a graph to be the largest $n$ for which the graph contains a clique of size $n\text{.}$ Any clique of size $n$ cannot be colored with fewer than $n$ colors, so we have a nice lower bound:

图中的一个团,是指其中所有顶点两两相邻的顶点集合。换言之,大小为 $n$ 的团,就是完全图 $K_n$ 的一个拷贝。我们把图的团数定义为:该图所包含的最大团的大小 $n$。任何大小为 $n$ 的团都无法用少于 $n$ 种颜色着色,于是我们得到一个漂亮的下界:

Theorem 2

定理 2

The chromatic number of a graph $G$ is at least the clique number of $G\text{.}$

图 $G$ 的色数至少等于 $G$ 的团数。

There are times when the chromatic number of $G$ is equal to the clique number. These graphs have a special name; they are called perfect. If you know that a graph is perfect, then finding the chromatic number is simply a matter of searching for the largest clique. There are special classes of graphs which can be proved to be perfect. One such class is the set of chordal graphs, which have the property that every cycle in the graph contains a chord—an edge between two vertices in of the cycle which are not adjacent in the cycle. However, not all graphs are perfect.

有时,图 $G$ 的色数恰好等于其团数。这类图有一个专门的名称,称为完美图。若已知某个图是完美的,那么求色数就只是去寻找最大团的问题。存在若干可被证明为完美的特殊图类,其中之一是弦图类:弦图具有这样的性质——图中的每条圈都含有一条弦,即连接该圈上两个在圈中不相邻的顶点的边。但并非所有图都是完美的。

For an upper bound, we can improve on “the number of vertices” by looking to the degrees of vertices. Let $\Delta(G)$ be the largest degree of any vertex in the graph $G\text{.}$ One reasonable guess for an upper bound on the chromatic number is $\chi(G) \le \Delta(G) + 1\text{.}$ Why is this reasonable? Starting with any vertex, it together with all of its neighbors can always be colored in $\Delta(G) + 1$ colors, since at most we are talking about $\Delta(G) + 1$ vertices in this set. Now fan out! At any point, if you consider an already colored vertex, some of its neighbors might be colored, some might not. But no matter what, that vertex and its neighbors could all be colored distinctly, since there are at most $\Delta(G)$ neighbors, plus the one vertex being considered.

要给出上界,我们可以通过考察顶点的度来改进「顶点数」这一界。记 $\Delta(G)$ 为图 $G$ 中任意顶点的最大度。关于色数的一个合理上界猜想是 $\chi(G) \le \Delta(G) + 1$。为何合理?从任一顶点出发,它与所有邻点一起,总能用 $\Delta(G) + 1$ 种颜色着色,因为这一集合至多包含 $\Delta(G) + 1$ 个顶点。接着向外扩展!在任意时刻,若考察一个已着色的顶点,它的某些邻点可能已着色,某些可能还没有。但无论如何,该顶点及其所有邻点都能被染成互不相同的颜色,因为邻点至多 $\Delta(G)$ 个,再加上所考察的那个顶点本身。

In fact, there are examples of graphs for which $\chi(G) = \Delta(G) + 1\text{.}$ For any $n\text{,}$ the complete graph $K_n$ has chromatic number $n\text{,}$ but $\Delta(K_n) = n-1$ (since every vertex is adjacent to every other vertex). Additionally, any odd cycle will have chromatic number 3, but the degree of every vertex in a cycle is 2. It turns out that these are the only two types of examples where we get equality, a result known as Brooks' Theorem.

事实上,存在一些满足 $\chi(G) = \Delta(G) + 1$ 的图。对任意 $n$,完全图 $K_n$ 的色数为 $n$,但 $\Delta(K_n) = n-1$(因为每个顶点都与其余所有顶点相邻)。此外,任意奇圈(奇数长度的圈)的色数为 3,但圈中每个顶点的度都是 2。结果表明,满足等号成立的例子只有上述两类,这一结论即布鲁克斯定理。

Theorem 3: Brooks' Theorem

定理 3:布鲁克斯定理

Any graph $G$ satisfies $\chi(G) \le \Delta(G)\text{,}$ unless $G$ is a complete graph or an odd cycle, in which case $\chi(G) = \Delta(G) + 1\text{.}$

任意图 $G$ 都满足 $\chi(G) \le \Delta(G)$,除非 $G$ 是完全图或奇圈,此时 $\chi(G) = \Delta(G) + 1$。

The proof of this theorem is just complicated enough that we will not present it here (although you are asked to prove a special case in the exercises). The adventurous reader is encouraged to find a book on graph theory for suggestions on how to prove the theorem.

这一定理的证明恰到好处地复杂,我们此处不作展示(不过习题中会要求你证明一个特例)。鼓励有探索精神的读者去找一本图论教材,了解其证明思路。

Coloring Edges 边着色

The chromatic number of a graph tells us about coloring vertices, but we could also ask about coloring edges. Just like with vertex coloring, we might insist that edges that are adjacent must be colored differently. Here, we are thinking of two edges as being adjacent if they are incident to the same vertex. The least number of colors required to properly color the edges of a graph $G$ is called the chromatic index of $G\text{,}$ written $\chi'(G)\text{.}$

图的色数告诉我们如何为顶点着色,但我们也可以考虑为边着色。与顶点着色类似,我们可以要求相邻的边必须染成不同颜色。这里,若两条边关联于同一个顶点,就认为它们相邻。为图 $G$ 的边正常着色所需的最少颜色数,称为 $G$ 的色指数,记作 $\chi'(G)$。

Example 3

示例 3

Six friends decide to spend the afternoon playing chess. Everyone will play everyone else once. They have plenty of chess sets but nobody wants to play more than one game at a time. Games will last an hour (thanks to their handy chess clocks). How many hours will the tournament last?

六位朋友决定下午下棋消遣。每个人都要与其他每个人对弈一局。他们有不少象棋,但谁都不想同时下多盘棋。每局棋持续一小时(多亏了他们方便的棋钟)。这场比赛要进行多少小时?

Solution

解答

Represent each player with a vertex and put an edge between two players if they will play each other. In this case, we get the graph $K_6\text{:}$

以每个棋手为一个顶点,若两人将对弈则在对应顶点间连一条边。于是我们得到图 $K_6$:
image-120.svg

We must color the edges; each color represents a different hour. Since different edges incident to the same vertex will be colored differently, no player will be playing two different games (edges) at the same time. Thus we need to know the chromatic index of $K_6\text{.}$

我们必须为边着色;每种颜色代表一个不同的时段。由于关联于同一顶点的不同边会被染成不同颜色,任何棋手都不会在同一时刻进行两盘不同的对局(边)。因此我们需要知道 $K_6$ 的色指数。

Notice that for sure $\chi'(K_6) \ge 5\text{,}$ since there is a vertex of degree 5. It turns out 5 colors is enough (go find such a coloring). Therefore the friends will play for 5 hours.

注意,$\chi'(K_6) \ge 5$ 是确定的,因为存在一个度为 5 的顶点。事实证明 5 种颜色已经足够(请自行找出这样一种着色)。因此这些朋友要下 5 小时。

Interestingly, if one of the friends in the above example left, the remaining 5 chess-letes would still need 5 hours: the chromatic index of $K_5$ is also 5.

有趣的是,若上例中的某位朋友离开,剩下 5 位棋手仍需 5 小时:$K_5$ 的色指数也是 5。

In general, what can we say about chromatic index? Certainly $\chi'(G) \ge \Delta(G)\text{.}$ But how much higher could it be? Only a little higher.

一般地,关于色指数我们能说些什么?显然 $\chi'(G) \ge \Delta(G)$。但它能比 $\Delta(G)$ 高出多少?只高出一点点。

Theorem 4: Vizing's Theorem

定理 4:维津定理

For any graph $G\text{,}$ the chromatic index $\chi'(G)$ is either $\Delta(G)$ or $\Delta(G) + 1\text{.}$

对任意图 $G$,其色指数 $\chi'(G)$ 要么等于 $\Delta(G)$,要么等于 $\Delta(G) + 1$。

At first this theorem makes it seem like chromatic index might not be very interesting. However, deciding which case a graph is in is not always easy. Graphs for which $\chi'(G) = \Delta(G)$ are called class 1, while the others are called class 2. Bipartite graphs always satisfy $\chi'(G) = \Delta(G)\text{,}$ so are class 1 (this was proved by König in 1916, decades before Vizing proved his theorem in 1964). In 1965 Vizing proved that all planar graphs with $\Delta(G) \ge 8$ are of class 1, but this does not hold for all planar graphs with $2 \le \Delta(G) \le 5\text{.}$ Vizing conjectured that all planar graphs with $\Delta(G) = 6$ or $\Delta(G) = 7$ are class 1; the $\Delta(G) = 7$ case was proved in 2001 by Sanders and Zhao; the $\Delta(G) = 6$ case is still open.

初看这一定理,色指数似乎并不怎么有趣。然而,要判断一个图属于哪种情况,并不总是容易。满足 $\chi'(G) = \Delta(G)$ 的图称为 1 类,其余的称为 2 类。二分图恒满足 $\chi'(G) = \Delta(G)$,故属于 1 类(这由 König 于 1916 年证明,比 Vizing 在 1964 年证明他的定理早了几十年)。Vizing 于 1965 年证明:所有满足 $\Delta(G) \ge 8$ 的平面图都属于 1 类,但对所有满足 $2 \le \Delta(G) \le 5$ 的平面图这并不成立。Vizing 猜想:所有满足 $\Delta(G) = 6$ 或 $\Delta(G) = 7$ 的平面图都属于 1 类;$\Delta(G) = 7$ 的情形由 Sanders 与 Zhao 于 2001 年证明;$\Delta(G) = 6$ 的情形至今仍未解决。

There is another interesting way we might consider coloring edges, quite different from what we have discussed so far. What if we colored every edge of a graph either red or blue. Can we do so without, say, creating a monochromatic triangle (i.e., an all red or all blue triangle)? Certainly for some graphs the answer is yes. Try doing so for $K_4\text{.}$ What about $K_5\text{?}$ $K_6\text{?}$ How far can we go?

还有另一种有趣的边着色思路,与前述大不相同。假如我们把图的每条边染成红色或蓝色,能否做到不出现单色三角形(即全红或全蓝的三角形)?对某些图答案当然是肯定的。试着对 $K_4$ 这样做。$K_5$ 呢?$K_6$ 呢?我们最多能走到哪一步?

The answer to the above problem is known and is a fun problem to do as an exercise. We could extend the question in a variety of ways. What if we had three colors? What if we were trying to avoid other graphs. The surprising fact is that very little is known about these questions. For example, we know that you need to go up to $K_{17}$ in order to force a monochromatic triangle using three colors, but nobody knows how big you need to go with more colors. Similarly, we know that using two colors $K_{18}$ is the smallest graph that forces a monochromatic copy of $K_4\text{,}$ but the best we have to force a monochromatic $K_5$ is a range, somewhere from $K_{43}$ to $K_{49}\text{.}$ If you are interested in these sorts of questions, this area of graph theory is called Ramsey theory. Check it out.

上述问题的答案是已知的,作为练习做起来很有趣。我们还能以多种方式拓展这个问题。若用三种颜色会怎样?若我们试图避开其他图又会怎样?令人惊讶的是,关于这些问题已知的结论极少。例如,我们知道:要迫使出现单色三角形,使用三种颜色时需一直大到 $K_{17}$;但用更多颜色时该取多大,则无人知晓。类似地,我们知道用两种颜色时,$K_{18}$ 是迫使出现单色 $K_4$ 的最小图;而要迫使出现单色 $K_5$,目前最好的结果是一个范围,大约在 $K_{43}$ 到 $K_{49}$ 之间。如果你对这类问题感兴趣,图论的这一分支称为拉姆齐理论。不妨深入了解。