FIXED maps.
This commit is contained in:
1 parent
3ca8339510
commit
41d02b1a85
3 files changed
+14
-28
No files matched your search
+12
-27
@@ -6,33 +6,24 @@ summary = '基于独立集的区域涂色方式计数方法'
|
||||
+++
|
||||
|
||||
|
||||
# 基于独立集的区域涂色方式计数方法
|
||||
|
||||
|
||||
对于排列组合中的区域上色问题,在中学阶段少有系统、规范的讨论方法。日常教学时老师会提到“将相同颜色的色块进行分组”,但实际操作过程中也常有遗漏,算了数分钟却发现ABCD都无法匹配的现象可谓屡见不鲜。本文将基于图论中的独立集,提出一种具有普遍性的统计方式,并探讨可能的优化方向。
|
||||
|
||||
|
||||
## 例题
|
||||
|
||||
# 基于独立集的区域涂色方式计数方法
|
||||
|
||||
提供四种不同颜色的颜料给图中六个区域涂色,要求每个区域涂一种颜色,有公共边的两个区域不能涂相同的颜色,则不同的涂色方法共有()种。
|
||||
|
||||
{{<figure src="/svgs/C0.svg" width="50%">}}
|
||||
|
||||
### 常规思路
|
||||
|
||||
### 常规思路
|
||||
|
||||
首先, $D,E,F$显然无法同色,对这三个区域有 $A_4^3$ 种涂法。
|
||||
当 $B,D$ 同色时,区域被分成 $\{A\},\{B,D\},\{C\},\{E\},\{F\}$四块,有 $A_4^3 \times 2 \times 3 = 144$ 种方案。
|
||||
当 $B,D$ 同色时,区域被分成 $\\{A\\},\\{B,D\\},\\{C\\},\\{E\\},\\{F\\}$四块,有 $A_4^3 \times 2 \times 3 = 144$ 种方案。
|
||||
$B,F$ 同色与 $B,D$ 同色相对称,也有 $144$ 种方案。
|
||||
最后, $B,D,F$ 之间均不同色时,有 $A _4 ^3 \times 2 \times 2 = 96$ 种方案。
|
||||
故总方案数为 $144 + 144 + 96 = 384$ 种。
|
||||
|
||||
### 基于独立集的思路
|
||||
|
||||
### 基于独立集的思路
|
||||
|
||||
|
||||
#### 理论
|
||||
|
||||
#### 理论
|
||||
|
||||
可将A~F抽象为图中的节点,用边连接具有公共边的色块对应的节点,形成图$C_1$:
|
||||
|
||||
@@ -80,26 +71,23 @@ graph TD
|
||||
C --- D
|
||||
C --- E;
|
||||
```
|
||||
|
||||
|
||||
此时,$C_2$ 中的边所连接的节点对应的,就是“一对不具有公共边的色块”,也就是一对可以被涂上同种颜色的色块。\
|
||||
那么,对于 $C_2$ 中的任意子图,如果其任意两个顶点间都有相邻的边,该子图对应的所有色块都可以被同种颜色涂色。\
|
||||
这样的子图在图论中被称为“团”。\
|
||||
方便起见,本文将用团的点集表示团,如 $\{A,C,E\}$ 表示由 $A,C,E$ 三个节点组成的团
|
||||
方便起见,本文将用团的点集表示团,如 $\\{A,C,E\\}$ 表示由 $A,C,E$ 三个节点组成的团。 \
|
||||
再将$m$种颜色分配给$i$个团,方案数为 $A_m^i$ 。
|
||||
|
||||
若将 $C_2$ 拆分为$i$个团的方案数为 $n_i$ ,提供的最大颜色数为 $m$,总染色方案数为 $N$ ,有:
|
||||
|
||||
$$N = \sum_{i = 1}^{m}({n_i} \times {A_m^i})$$
|
||||
|
||||
|
||||
#### 实现
|
||||
|
||||
#### 实现
|
||||
|
||||
由于对任意节点,其参与形成的不同的团不会处于同一分割方式中,可递归地对图进行分割。
|
||||
|
||||
如,$A$ 节点可形成 $\{A\},\{A,C\},\{A,E\},\{A,F\},\{A,C,E\}$几个团。\
|
||||
以分割 $\{A\}$ 为例。此时,除$\{A\}$以外的部分形成了一张新的子图 $C_3$:
|
||||
如,$A$ 节点可形成 $\\{A\\},\\{A,C\\},\\{A,E\\},\\{A,F\\},\\{A,C,E\\}$几个团。\
|
||||
以分割 $\\{A\\}$ 为例。此时,除$\\{A\\}$以外的部分形成了一张新的子图 $C_3$:
|
||||
|
||||
```mermaid
|
||||
|
||||
@@ -118,14 +106,11 @@ graph TD
|
||||
C --- D
|
||||
C --- E;
|
||||
```
|
||||
|
||||
|
||||
选择 $C_3$ 中的节点分类讨论,最终递归地统计每种分割方案产生的团的数量,即可得到表达式中的 $n_i$。
|
||||
但在实际计算过程中,这种繁琐的递归不仅效率及其低下,也很容易出错。因此,对其进行优化是有必要的。
|
||||
|
||||
|
||||
#### 一种优化思路
|
||||
|
||||
#### 一种优化思路
|
||||
|
||||
分割时常常会遇到一类链状的图,如例题中的$C_3$。在图论中,这类图被称为路径图,含 $n$ 个节点的路径图就用 $P_n$ 表示。\
|
||||
这类路径图的节点排列方式各有不同,但具有相同的结构,也就有相同的分割方式与涂色方案。
|
||||
@@ -135,7 +120,7 @@ graph TD
|
||||
若将任意两相邻节点合并为新的团,则有 $C_{k-1}^1 = k-1$ 种方案,即 $f(k-1,k) = k-1$ 。\
|
||||
$i < 3$ 且 $n < 4$时,路径图较为简单, $f(i,k)$ 的值小,可直接数出。见下表:
|
||||
|
||||
| $n$ | $f(i,n)$ |
|
||||
|$n$|$f(i,n)$|
|
||||
|-|-|
|
||||
|1|$f(1,1) = 1$|
|
||||
|2|$f(1,2) = 1,f(2,2) = 1$|
|
||||
|
||||
@@ -10,4 +10,4 @@ theme = 'PaperMod'
|
||||
defaultTheme = "auto"
|
||||
showCodeCopyButtons = true
|
||||
math = true
|
||||
author = "StarCells"
|
||||
author = "StarCells"
|
||||
@@ -0,0 +1 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="349" height="402"><defs><clipPath id="qGshPSKpuznw"><path fill="none" stroke="none" d=" M 0 0 L 349 0 L 349 402 L 0 402 L 0 0 Z"/></clipPath></defs><g transform="scale(1,1)" clip-path="url(#qGshPSKpuznw)"><g><rect fill="rgb(255,255,255)" stroke="none" x="0" y="0" width="349" height="402" fill-opacity="1"/><path fill="rgb(102,102,102)" stroke="none" paint-order="stroke fill markers" fill-rule="evenodd" d=" M 29.07470050178071 17.239720536349637 L 29.07470050178071 163.26106038208806 L 175.09604034751882 17.239720536349637 Z" fill-opacity="0.2"/><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="77" y="65" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">A</text><text fill="none" stroke="rgb(255,255,255)" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="77" y="65" text-anchor="start" dominant-baseline="alphabetic" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10" stroke-width="3">A</text><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="77" y="65" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">A</text><path fill="rgb(102,102,102)" stroke="none" paint-order="stroke fill markers" fill-rule="evenodd" d=" M 175.09604034751882 17.239720536349637 L 321.11738019325696 17.239720536349637 L 321.11738019325696 163.26106038208806 Z" fill-opacity="0.2"/><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="272" y="65" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">C</text><text fill="none" stroke="rgb(255,255,255)" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="272" y="65" text-anchor="start" dominant-baseline="alphabetic" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10" stroke-width="3">C</text><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="272" y="65" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">C</text><path fill="rgb(102,102,102)" stroke="none" paint-order="stroke fill markers" fill-rule="evenodd" d=" M 102.08537042464977 90.25039045921886 L 175.09604034751882 17.239720536349637 L 248.10671027038788 90.25039045921886 Z" fill-opacity="0.2"/><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="175" y="65" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">B</text><text fill="none" stroke="rgb(255,255,255)" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="175" y="65" text-anchor="start" dominant-baseline="alphabetic" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10" stroke-width="3">B</text><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="175" y="65" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">B</text><path fill="rgb(102,102,102)" stroke="none" paint-order="stroke fill markers" fill-rule="evenodd" d=" M 102.08537042464977 90.25039045921886 L 175.09604034751882 235.01316040246078 L 248.10671027038788 90.25039045921886 Z" fill-opacity="0.2"/><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="175" y="138" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">E</text><text fill="none" stroke="rgb(255,255,255)" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="175" y="138" text-anchor="start" dominant-baseline="alphabetic" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10" stroke-width="3">E</text><text fill="rgb(102,102,102)" stroke="none" font-family="geogebra-sans-serif, sans-serif" font-size="16px" font-style="normal" font-weight="normal" text-decoration="normal" x="175" y="138" text-anchor="start" dominant-baseline="alphabetic" fill-opacity="1">E</text><path fill="rgb(102,102,102)" stroke="none" paint-order="stroke fill markers" fill-rule="evenodd" d=" M 102.08537042464977 90.25039045921886 L 175.09604034751882 235.01316040246078 LLine truncated
|
||||
|
After Width: | Height: | Size: 23 KiB |
Reference in new issue
Block a user