Add diamond coloring conjecture, parity-separation reformulation, and counterexample search

Extends paper with: a notation section for color-class preimages; the
plane diamond coloring definition (4-coloring whose two classes lift to a
2-coloring of some BFS-rooted diamond scaffold); a connectedness lemma
for the scaffold; a proposition reformulating the property as parity-
separation of two color classes by BFS layers; a remark noting this is
strictly stronger than 4CT; and the conjecture that every maximal planar
graph admits such a coloring.

Adds plane_diamond_coloring.py with get_plane_diamond_scaffold and a
counterexample search that reduces the per-root check to 4-colorability
of an auxiliary graph forcing two colors onto opposite parity layers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 12:31:33 -04:00
parent b7777cb45e
commit 9e86122818
7 changed files with 193 additions and 47 deletions
+10 -4
View File
@@ -1,9 +1,15 @@
\relax
\@writefile{toc}{\contentsline {section}{\tocsection {}{}{Notation}}{1}{}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\tocsection {}{1}{Definitions}}{1}{}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\tocsection {}{2}{Results}}{1}{}\protected@file@percent }
\citation{appel1977every}
\citation{robertson1997four}
\bibcite{appel1977every}{1}
\bibcite{robertson1997four}{2}
\newlabel{tocindent-1}{0pt}
\newlabel{tocindent0}{0pt}
\newlabel{tocindent0}{12.7778pt}
\newlabel{tocindent1}{17.77782pt}
\newlabel{tocindent2}{0pt}
\newlabel{tocindent3}{0pt}
\@writefile{toc}{\contentsline {section}{\tocsection {}{1}{Definitions}}{1}{}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\tocsection {}{2}{Results}}{1}{}\protected@file@percent }
\gdef \@abspage@last{1}
\@writefile{toc}{\contentsline {section}{\tocsection {}{}{References}}{2}{}\protected@file@percent }
\gdef \@abspage@last{2}
@@ -1,5 +1,5 @@
# Fdb version 3
["pdflatex"] 1778341899 "paper.tex" "paper.pdf" "paper" 1778341900
["pdflatex"] 1778344156 "paper.tex" "paper.pdf" "paper" 1778344156
"/usr/local/texlive/2022/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 ""
"/usr/local/texlive/2022/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex7.tfm" 1246382020 1004 54797486969f23fa377b128694d548df ""
"/usr/local/texlive/2022/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex8.tfm" 1246382020 988 bdf658c3bfc2d96d3c8b02cfc1c94c20 ""
@@ -18,9 +18,11 @@
"/usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmsy6.tfm" 1136768653 1116 933a60c408fc0a863a92debe84b2d294 ""
"/usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmsy8.tfm" 1136768653 1120 8b7d695260f3cff42e636090a8002094 ""
"/usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmti10.tfm" 1136768653 1480 aa8e34af0eb6a2941b776984cf1dfdc4 ""
"/usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmti7.tfm" 1136768653 1492 86331993fe614793f5e7e755835c31c5 ""
"/usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmti8.tfm" 1136768653 1504 1747189e0441d1c18f3ea56fafc1c480 ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb" 1248133631 34811 78b52f49e893bcba91bd7581cdc144c0 ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmcsc10.pfb" 1248133631 32001 6aeea3afe875097b1eb0da29acd61e28 ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb" 1248133631 30251 6afa5cb1d0204815a708a080681d4674 ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb" 1248133631 36299 5f9df58c2139e7edcf37c8fca4bd384d ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb" 1248133631 36281 c355509802a035cadc5f15869451dcee ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb" 1248133631 35752 024fb6c41858982481f6968b5fc26508 ""
@@ -29,6 +31,7 @@
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb" 1248133631 32569 5e5ddc8df908dea60932f3c484a54c0d ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb" 1248133631 32716 08e384dc442464e7285e891af9f45947 ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb" 1248133631 37944 359e864bd06cde3b1cf57bb20757fb06 ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti7.pfb" 1248133631 36607 d654cb3f2bc54f57509240071db3bffa ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti8.pfb" 1248133631 35660 fb24af7afbadb71801619f1415838111 ""
"/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/symbols/msam10.pfb" 1248133631 31764 459c573c03a4949a528c2cc7f557e217 ""
"/usr/local/texlive/2022/texmf-dist/tex/latex/amscls/amsart.cls" 1591045760 61881 a7369c346c2922a758ae6283cc1ed014 ""
@@ -45,8 +48,8 @@
"/usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map" 1647878959 4410336 7d30a02e9fa9a16d7d1f8d037ba69641 ""
"/usr/local/texlive/2022/texmf-var/web2c/pdftex/pdflatex.fmt" 1665017617 2826443 7e98410c533054b636c6470db83a27bc ""
"/usr/local/texlive/2022/texmf.cnf" 1647878952 577 209b46be99c9075fd74d4c0369380e8c ""
"paper.aux" 1778341900 377 e4a4bae3d140fd6461ef3b90b48a4e36 "pdflatex"
"paper.tex" 1778341891 3894 9067f9f68588b27557ec016c8a9ca5e1 ""
"paper.aux" 1778344156 697 3f22ac2880dcfce06793ac851e5b5d36 "pdflatex"
"paper.tex" 1778344142 7304 251fb4f84f05f1ed3480fd521a52c92f ""
(generated)
"paper.aux"
"paper.log"
+4
View File
@@ -144,9 +144,12 @@ INPUT /usr/local/texlive/2022/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm7
INPUT /usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmti10.tfm
OUTPUT paper.pdf
INPUT /usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map
INPUT /usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmti7.tfm
INPUT /usr/local/texlive/2022/texmf-dist/fonts/tfm/public/cm/cmti7.tfm
INPUT paper.aux
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmcsc10.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb
@@ -155,5 +158,6 @@ INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti7.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti8.pfb
INPUT /usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/symbols/msam10.pfb
+42 -40
View File
@@ -1,4 +1,4 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.10.5) 9 MAY 2026 11:51
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.10.5) 9 MAY 2026 12:29
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
@@ -117,56 +117,58 @@ File: l3backend-pdftex.def 2022-02-07 L3 backend support: PDF output (pdfTeX)
(./paper.aux)
\openout1 = `paper.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 52.
LaTeX Font Info: ... okay on input line 52.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 52.
LaTeX Font Info: ... okay on input line 52.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 52.
LaTeX Font Info: ... okay on input line 52.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 52.
LaTeX Font Info: ... okay on input line 52.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 52.
LaTeX Font Info: ... okay on input line 52.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 52.
LaTeX Font Info: ... okay on input line 52.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 52.
LaTeX Font Info: ... okay on input line 52.
LaTeX Font Info: Trying to load font information for U+msa on input line 52.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 54.
LaTeX Font Info: ... okay on input line 54.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 54.
LaTeX Font Info: ... okay on input line 54.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 54.
LaTeX Font Info: ... okay on input line 54.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 54.
LaTeX Font Info: ... okay on input line 54.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 54.
LaTeX Font Info: ... okay on input line 54.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 54.
LaTeX Font Info: ... okay on input line 54.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 54.
LaTeX Font Info: ... okay on input line 54.
LaTeX Font Info: Trying to load font information for U+msa on input line 54.
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info: Trying to load font information for U+msb on input line 52.
LaTeX Font Info: Trying to load font information for U+msb on input line 54.
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
) [1{/usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./
paper.aux) )
) [1{/usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2]
(./paper.aux) )
Here is how much of TeX's memory you used:
1714 strings out of 478268
23914 string characters out of 5846347
323202 words of memory out of 5000000
19800 multiletter control sequences out of 15000+600000
475666 words of font info for 53 fonts, out of 8000000 for 9000
1725 strings out of 478268
24057 string characters out of 5846347
325269 words of memory out of 5000000
19810 multiletter control sequences out of 15000+600000
476364 words of font info for 55 fonts, out of 8000000 for 9000
1302 hyphenation exceptions out of 8191
69i,5n,76p,381b,204s stack positions out of 10000i,1000n,20000p,200000b,200000s
</usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/
cmbx10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/c
mcsc10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/c
mmi10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cm
mi7.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr1
0.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.p
fb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb>
</usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb><
/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb></u
sr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb></us
r/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti8.pfb></usr/
local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/symbols/msam10.pfb>
Output written on paper.pdf (1 page, 139867 bytes).
69i,6n,76p,613b,223s stack positions out of 10000i,1000n,20000p,200000b,200000s
</usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts
/cm/cmbx10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/
cm/cmcsc10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/
cm/cmex10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/c
m/cmmi10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm
/cmmi7.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/c
mr10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr
7.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.p
fb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pf
b></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb>
</usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb><
/usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti7.pfb></u
sr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmti8.pfb></usr
/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/symbols/msam10.pfb>
Output written on paper.pdf (2 pages, 176410 bytes).
PDF statistics:
68 PDF objects out of 1000 (max. 8388607)
40 compressed objects within 1 object stream
81 PDF objects out of 1000 (max. 8388607)
48 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
Binary file not shown.
+57
View File
@@ -38,6 +38,8 @@
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{conjecture}[theorem]{Conjecture}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
@@ -76,6 +78,10 @@
\maketitle
\section*{Notation}
For a coloring $C : V(G) \to S$ and a color $c \in S$, we write $C^{-1}(c) = \{v \in V(G) : C(v) = c\}$ for the preimage of $c$ under $C$, i.e., the color class of $c$.
\section{Definitions}
\begin{definition}
@@ -90,6 +96,16 @@ Equivalently, $L_i = \{v \in V(G) : d(v, u) = i\}$, where $d(v, u)$ denotes the
Let $G$ be a maximal planar graph with a plane embedding, and let $\{L_0, L_1, L_2, \dots\}$ be the distance partition of $G$ from some $u \in V(G)$. The \emph{diamond scaffold} of $G$ relative to $u$ is the spanning subgraph $G^\diamond \subseteq G$ obtained by removing every edge $\{x, y\} \in E(G)$ such that $x, y \in L_i$ for some $i$.
\end{definition}
\begin{definition}
Let $G$ be a maximal planar graph. A \emph{plane diamond coloring} of $G$ is a proper $4$-coloring $C$ of $G$ such that there exist two colors $c_a, c_b$ and a diamond scaffold $G^\diamond$ of $G$ with a proper $2$-coloring $C^\diamond : V(G) \to \{c_a, c_b\}$ satisfying
\[
C^\diamond(v) = c_a \quad \text{for every } v \in C^{-1}(c_a),
\]
\[
C^\diamond(v) = c_b \quad \text{for every } v \in C^{-1}(c_b).
\]
\end{definition}
\section{Results}
\begin{theorem}
@@ -104,6 +120,47 @@ For any edge $\{x, y\} \in E(G)$, the depths of $x$ and $y$ differ by at most $1
By construction, $G^\diamond$ contains no edge with both endpoints in the same level $L_i$. Combined with the bound above, every edge of $G^\diamond$ joins some $L_i$ to $L_{i+1}$. Color each vertex $v \in L_i$ by the parity of $i$. Every edge of $G^\diamond$ connects vertices of opposite parity, so this is a proper $2$-coloring.
\end{proof}
\begin{lemma}
The diamond scaffold $G^\diamond$ of a maximal planar graph $G$ relative to $u$ is connected.
\end{lemma}
\begin{proof}
Let $\{L_0, L_1, L_2, \dots\}$ be the distance partition of $G$ from $u$. We show by induction on $i$ that every vertex of $L_i$ is connected to $u$ in $G^\diamond$. The base case $i = 0$ is immediate, since $L_0 = \{u\}$. For $i \geq 1$, let $v \in L_i$. By definition of $L_i$, there is a shortest path from $v$ to $u$ of length $i$ in $G$, whose penultimate vertex $w$ lies in $L_{i-1}$. The edge $\{v, w\}$ joins $L_i$ to $L_{i-1}$, hence is not a level edge, hence belongs to $G^\diamond$. By the inductive hypothesis $w$ is connected to $u$ in $G^\diamond$, so $v$ is as well.
\end{proof}
\begin{proposition}
A maximal planar graph $G$ has a plane diamond coloring if and only if there exist a proper $4$-coloring $C$ of $G$, a vertex $u \in V(G)$, and two distinct colors $c_a, c_b$ such that, with respect to the distance partition $\{L_0, L_1, L_2, \dots\}$ of $G$ from $u$,
\[
C^{-1}(c_a) \subseteq \bigcup_{i \text{ even}} L_i \qquad \text{and} \qquad C^{-1}(c_b) \subseteq \bigcup_{i \text{ odd}} L_i.
\]
\end{proposition}
\begin{proof}
Since $G^\diamond$ is connected and bipartite (Theorem 2.1 and Lemma 2.2), its proper $2$-coloring is unique up to swapping the two colors, and is given by the parity of level. Hence a proper $2$-coloring $C^\diamond : V(G) \to \{c_a, c_b\}$ of $G^\diamond$ exists with $C^\diamond(v) = c_a$ on the even-parity layers and $C^\diamond(v) = c_b$ on the odd-parity layers (or vice versa). The agreement condition $C(v) = C^\diamond(v)$ on $C^{-1}(c_a) \cup C^{-1}(c_b)$ is then equivalent to the stated containment.
\end{proof}
\begin{remark}
The conjecture below asserts a structural property of $4$-colorings of maximal planar graphs strictly stronger than the conclusion of the Four Color Theorem \cite{appel1977every,robertson1997four}: it requires not merely the existence of a proper $4$-coloring, but the existence of a proper $4$-coloring together with a root $u$ such that two of the four color classes are separated by the parity of the BFS layering from $u$.
\end{remark}
\begin{conjecture}
Every maximal planar graph $G$ has a plane diamond coloring.
\end{conjecture}
\begin{thebibliography}{9}
\bibitem{appel1977every}
K.~Appel and W.~Haken,
\emph{Every planar map is four colorable},
Illinois Journal of Mathematics, vol.~21, no.~3, pp.~429--567, 1977.
\bibitem{robertson1997four}
N.~Robertson, D.~Sanders, P.~Seymour, and R.~Thomas,
\emph{The four-colour theorem},
Journal of Combinatorial Theory, Series B, vol.~70, no.~1, pp.~2--44, 1997.
\end{thebibliography}
\end{document}
%-----------------------------------------------------------------------
+74
View File
@@ -0,0 +1,74 @@
"""Plane diamond coloring on maximal planar graphs."""
from typing import Any
from sage.all import Graph, graphs # type: ignore[attr-defined] # pylint: disable=no-name-in-module
from lib.colored_graphs import canonize_and_save_graph
def get_plane_diamond_scaffold(g: Graph, v: Any) -> Graph:
"""
Return the diamond scaffold of g relative to v.
The diamond scaffold is the spanning subgraph of g obtained by removing
every edge whose endpoints lie in the same level of the distance
partition of g from v.
"""
distances = dict(g.breadth_first_search(v, report_distance=True))
scaffold = g.copy()
scaffold.delete_edges([(x, y) for x, y in g.edges(labels=False) if distances[x] == distances[y]])
return scaffold
def has_plane_diamond_coloring_at_root(g: Graph, u: Any) -> bool:
"""
Return True iff g admits a proper 4-coloring with two color classes
parity-separated by the BFS distance partition from u.
Equivalent to 4-colorability of the auxiliary graph H_u obtained by
adjoining vertices v_a, v_b to g, with v_a adjacent to every odd-parity
layer vertex, v_b adjacent to every even-parity layer vertex, and a
v_a v_b edge.
"""
distances = dict(g.breadth_first_search(u, report_distance=True))
odd_vertices = [v for v in g.vertices() if distances[v] % 2 == 1]
even_vertices = [v for v in g.vertices() if distances[v] % 2 == 0]
h = g.copy()
v_a = max(g.vertices()) + 1
v_b = v_a + 1
h.add_vertex(v_a)
h.add_vertex(v_b)
h.add_edges([(v_a, w) for w in odd_vertices])
h.add_edges([(v_b, w) for w in even_vertices])
h.add_edge(v_a, v_b)
return h.chromatic_number() <= 4
def has_plane_diamond_coloring(g: Graph) -> bool:
"""Return True iff some root vertex of g witnesses a plane diamond coloring."""
return any(has_plane_diamond_coloring_at_root(g, u) for u in g.vertices())
def search_counterexample(n: int, num_trials: int) -> Graph | None:
"""
Sample random maximal planar graphs of order n and return the first one
with no plane diamond coloring, or None if none is found.
"""
for trial in range(num_trials):
g = graphs.RandomTriangulation(n)
if not has_plane_diamond_coloring(g):
print(f"Counterexample found on trial {trial + 1}")
return g
if (trial + 1) % 10 == 0:
print(f"Checked {trial + 1}/{num_trials} graphs of order {n}, no counterexample yet")
return None
if __name__ == "__main__":
import sys
n = int(sys.argv[1]) if len(sys.argv) > 1 else 12
num_trials = int(sys.argv[2]) if len(sys.argv) > 2 else 100
counterexample = search_counterexample(n, num_trials)
if counterexample is None:
print(f"No counterexample found in {num_trials} random triangulations of order {n}")
else:
canonical, graph_dir = canonize_and_save_graph(counterexample)
print(f"Counterexample saved to {graph_dir}")