FIXED mermaid.

This commit is contained in:
starcells committed 2026-03-21 01:11:08 +08:00
1 parent 49364e80af
commit 3ca8339510
5 files changed
+60 -242

No files matched your search

+60 -5
View File
@@ -17,8 +17,6 @@ summary = '基于独立集的区域涂色方式计数方法'
提供四种不同颜色的颜料给图中六个区域涂色,要求每个区域涂一种颜色,有公共边的两个区域不能涂相同的颜色,则不同的涂色方法共有()种。
{{<figure src="/svgs/C0.svg" width="50%">}}
### 常规思路
@@ -38,11 +36,51 @@ $B,F$ 同色与 $B,D$ 同色相对称,也有 $144$ 种方案。
可将A~F抽象为图中的节点,用边连接具有公共边的色块对应的节点,形成图$C_1$:
{{<figure src="/svgs/C1.svg" width="50%">}}
```mermaid
graph TD
classDef nodeStyle fill:#d3d3d3, stroke:#333, stroke-width:2px;
linkStyle default stroke:#808080, stroke-width:5.5;
A((A)):::nodeStyle
B((B)):::nodeStyle
C((C)):::nodeStyle
D((D)):::nodeStyle
E((E)):::nodeStyle
F((F)):::nodeStyle
A --- B
A --- D;
B --- C
B --- E;
C --- F;
D --- E
D --- F;
E --- F;
```
将每个节点和与之相连的节点分离,和与之不相连的节点相连(即构建 $C_1$ 的独立集),形成图$C_2$:
{{<figure src="/svgs/C2.svg" width="50%">}}
```mermaid
graph TD
classDef nodeStyle fill:#d3d3d3, stroke:#333, stroke-width:2px;
linkStyle default stroke:#808080, stroke-width:5.5;
A((A)):::nodeStyle
B((B)):::nodeStyle
C((C)):::nodeStyle
D((D)):::nodeStyle
E((E)):::nodeStyle
F((F)):::nodeStyle
A --- C
A --- E
A --- F;
B --- D
B --- F;
C --- D
C --- E;
```
此时,$C_2$ 中的边所连接的节点对应的,就是“一对不具有公共边的色块”,也就是一对可以被涂上同种颜色的色块。\
那么,对于 $C_2$ 中的任意子图,如果其任意两个顶点间都有相邻的边,该子图对应的所有色块都可以被同种颜色涂色。\
@@ -63,7 +101,24 @@ $$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$:
{{<figure src="/svgs/C3.svg" width="50%">}}
```mermaid
graph TD
classDef nodeStyle fill:#d3d3d3, stroke:#333, stroke-width:2px;
linkStyle default stroke:#808080, stroke-width:5.5;
B((B)):::nodeStyle
C((C)):::nodeStyle
D((D)):::nodeStyle
E((E)):::nodeStyle
F((F)):::nodeStyle
B --- D
B --- F;
C --- D
C --- E;
```
选择 $C_3$ 中的节点分类讨论,最终递归地统计每种分割方案产生的团的数量,即可得到表达式中的 $n_i$。
但在实际计算过程中,这种繁琐的递归不仅效率及其低下,也很容易出错。因此,对其进行优化是有必要的。
-1
View File
@@ -1 +0,0 @@
<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

Before

Width:  |  Height:  |  Size: 23 KiB

-89
View File
@@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.2.1 (20241206.2353)
-->
<!-- Title: CA Pages: 1 -->
<svg width="105pt" height="231pt"
viewBox="0.00 0.00 104.80 231.20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 227.2)">
<title>CA</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-227.2 100.8,-227.2 100.8,4 -4,4"/>
<!-- A -->
<g id="node1" class="node">
<title>A</title>
<ellipse fill="grey" stroke="black" cx="58.4" cy="-208.8" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="58.4" y="-203.75" font-family="Times,serif" font-size="14.00">A</text>
</g>
<!-- B -->
<g id="node2" class="node">
<title>B</title>
<ellipse fill="grey" stroke="black" cx="35.4" cy="-144" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="35.4" y="-138.95" font-family="Times,serif" font-size="14.00">B</text>
</g>
<!-- A&#45;&#45;B -->
<g id="edge1" class="edge">
<title>A&#45;&#45;B</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M53.63,-194.79C49.69,-184.01 44.11,-168.77 40.16,-158"/>
</g>
<!-- D -->
<g id="node3" class="node">
<title>D</title>
<ellipse fill="grey" stroke="black" cx="82.4" cy="-144" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="82.4" y="-138.95" font-family="Times,serif" font-size="14.00">D</text>
</g>
<!-- A&#45;&#45;D -->
<g id="edge2" class="edge">
<title>A&#45;&#45;D</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M63.37,-194.79C67.49,-184.01 73.32,-168.77 77.43,-158"/>
</g>
<!-- C -->
<g id="node4" class="node">
<title>C</title>
<ellipse fill="grey" stroke="black" cx="14.4" cy="-79.2" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="14.4" y="-74.15" font-family="Times,serif" font-size="14.00">C</text>
</g>
<!-- B&#45;&#45;C -->
<g id="edge3" class="edge">
<title>B&#45;&#45;C</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M31.05,-129.99C27.44,-119.21 22.35,-103.97 18.75,-93.2"/>
</g>
<!-- E -->
<g id="node5" class="node">
<title>E</title>
<ellipse fill="grey" stroke="black" cx="61.4" cy="-79.2" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="61.4" y="-74.15" font-family="Times,serif" font-size="14.00">E</text>
</g>
<!-- B&#45;&#45;E -->
<g id="edge4" class="edge">
<title>B&#45;&#45;E</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M40.66,-130.29C45.17,-119.4 51.64,-103.78 56.15,-92.89"/>
</g>
<!-- D&#45;&#45;E -->
<g id="edge6" class="edge">
<title>D&#45;&#45;E</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M78.05,-129.99C74.44,-119.21 69.35,-103.97 65.75,-93.2"/>
</g>
<!-- F -->
<g id="node6" class="node">
<title>F</title>
<ellipse fill="grey" stroke="black" cx="61.4" cy="-14.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="61.4" y="-9.35" font-family="Times,serif" font-size="14.00">F</text>
</g>
<!-- D&#45;&#45;F -->
<g id="edge7" class="edge">
<title>D&#45;&#45;F</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M84.69,-129.53C86.93,-113.79 89.33,-87.08 84.4,-64.8 81.37,-51.13 74.16,-36.75 68.61,-27.06"/>
</g>
<!-- C&#45;&#45;F -->
<g id="edge5" class="edge">
<title>C&#45;&#45;F</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M22.8,-66.97C31.36,-55.54 44.54,-37.93 53.07,-26.53"/>
</g>
<!-- E&#45;&#45;F -->
<g id="edge8" class="edge">
<title>E&#45;&#45;F</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M61.4,-64.57C61.4,-54.04 61.4,-39.53 61.4,-29"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

-84
View File
@@ -1,84 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.2.1 (20241206.2353)
-->
<!-- Title: C2 Pages: 1 -->
<svg width="126pt" height="166pt"
viewBox="0.00 0.00 125.80 166.40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 162.4)">
<title>C2</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-162.4 121.8,-162.4 121.8,4 -4,4"/>
<!-- A -->
<g id="node1" class="node">
<title>A</title>
<ellipse fill="grey" stroke="black" cx="35.4" cy="-144" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="35.4" y="-138.95" font-family="Times,serif" font-size="14.00">A</text>
</g>
<!-- C -->
<g id="node2" class="node">
<title>C</title>
<ellipse fill="grey" stroke="black" cx="35.4" cy="-79.2" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="35.4" y="-74.15" font-family="Times,serif" font-size="14.00">C</text>
</g>
<!-- A&#45;&#45;C -->
<g id="edge1" class="edge">
<title>A&#45;&#45;C</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M35.4,-129.37C35.4,-118.84 35.4,-104.33 35.4,-93.8"/>
</g>
<!-- E -->
<g id="node3" class="node">
<title>E</title>
<ellipse fill="grey" stroke="black" cx="14.4" cy="-14.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="14.4" y="-9.35" font-family="Times,serif" font-size="14.00">E</text>
</g>
<!-- A&#45;&#45;E -->
<g id="edge2" class="edge">
<title>A&#45;&#45;E</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M28.19,-131.34C22.64,-121.65 15.43,-107.27 12.4,-93.6 7.47,-71.32 9.87,-44.61 12.11,-28.87"/>
</g>
<!-- F -->
<g id="node4" class="node">
<title>F</title>
<ellipse fill="grey" stroke="black" cx="82.4" cy="-79.2" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="82.4" y="-74.15" font-family="Times,serif" font-size="14.00">F</text>
</g>
<!-- A&#45;&#45;F -->
<g id="edge3" class="edge">
<title>A&#45;&#45;F</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M43.8,-131.77C52.36,-120.34 65.54,-102.73 74.07,-91.33"/>
</g>
<!-- C&#45;&#45;E -->
<g id="edge7" class="edge">
<title>C&#45;&#45;E</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M31.05,-65.19C27.44,-54.41 22.35,-39.17 18.75,-28.4"/>
</g>
<!-- D -->
<g id="node6" class="node">
<title>D</title>
<ellipse fill="grey" stroke="black" cx="92.4" cy="-14.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="92.4" y="-9.35" font-family="Times,serif" font-size="14.00">D</text>
</g>
<!-- C&#45;&#45;D -->
<g id="edge6" class="edge">
<title>C&#45;&#45;D</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M44.81,-67.83C55.44,-56.12 72.61,-37.2 83.16,-25.58"/>
</g>
<!-- B -->
<g id="node5" class="node">
<title>B</title>
<ellipse fill="grey" stroke="black" cx="103.4" cy="-144" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="103.4" y="-138.95" font-family="Times,serif" font-size="14.00">B</text>
</g>
<!-- B&#45;&#45;F -->
<g id="edge5" class="edge">
<title>B&#45;&#45;F</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M99.05,-129.99C95.44,-119.21 90.35,-103.97 86.75,-93.2"/>
</g>
<!-- B&#45;&#45;D -->
<g id="edge4" class="edge">
<title>B&#45;&#45;D</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M105.01,-129.37C106.57,-113.72 108.31,-87.29 105.4,-64.8 103.76,-52.14 99.85,-38.09 96.75,-28.22"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

-63
View File
@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.2.1 (20241206.2353)
-->
<!-- Title: C3_1 Pages: 1 -->
<svg width="102pt" height="131pt"
viewBox="0.00 0.00 101.60 130.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 126.8)">
<title>C3_1</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-126.8 97.6,-126.8 97.6,4 -4,4"/>
<!-- B -->
<g id="node1" class="node">
<title>B</title>
<ellipse fill="grey" stroke="black" cx="14.4" cy="-84.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="14.4" y="-79.35" font-family="Times,serif" font-size="14.00">B</text>
</g>
<!-- D -->
<g id="node2" class="node">
<title>D</title>
<ellipse fill="grey" stroke="black" cx="79.2" cy="-61.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="79.2" y="-56.35" font-family="Times,serif" font-size="14.00">D</text>
</g>
<!-- B&#45;&#45;D -->
<g id="edge1" class="edge">
<title>B&#45;&#45;D</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M28.41,-79.63C39.19,-75.69 54.43,-70.11 65.2,-66.16"/>
</g>
<!-- F -->
<g id="node3" class="node">
<title>F</title>
<ellipse fill="grey" stroke="black" cx="79.2" cy="-108.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="79.2" y="-103.35" font-family="Times,serif" font-size="14.00">F</text>
</g>
<!-- B&#45;&#45;F -->
<g id="edge2" class="edge">
<title>B&#45;&#45;F</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M28.41,-89.37C39.19,-93.49 54.43,-99.32 65.2,-103.43"/>
</g>
<!-- C -->
<g id="node4" class="node">
<title>C</title>
<ellipse fill="grey" stroke="black" cx="14.4" cy="-37.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="14.4" y="-32.35" font-family="Times,serif" font-size="14.00">C</text>
</g>
<!-- C&#45;&#45;D -->
<g id="edge3" class="edge">
<title>C&#45;&#45;D</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M28.41,-42.37C39.19,-46.49 54.43,-52.32 65.2,-56.43"/>
</g>
<!-- E -->
<g id="node5" class="node">
<title>E</title>
<ellipse fill="grey" stroke="black" cx="79.2" cy="-14.4" rx="14.4" ry="14.4"/>
<text text-anchor="middle" x="79.2" y="-9.35" font-family="Times,serif" font-size="14.00">E</text>
</g>
<!-- C&#45;&#45;E -->
<g id="edge4" class="edge">
<title>C&#45;&#45;E</title>
<path fill="none" stroke="gray" stroke-width="5.5" d="M28.41,-32.63C39.19,-28.69 54.43,-23.11 65.2,-19.16"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB