Draw a medial tire cut from a random n=20 graph

Add experiments/draw_medial_tire_cut.py, the paper-graphics companion
that imports run_experiment and emits a TikZ panel (walk-depth labels +
cut slits) per recognised tread via to_tikz. Add the resulting figure
(Example 3.2, Figure 2): the single recognised tread T_2 of the medial
tire decomposition of a random maximal planar graph on 20 vertices
(seed 72), an 8-cycle piece with a bite, labelled and cut.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-14 23:55:00 -04:00
parent a22ca4b888
commit 9d7cb7644e
5 changed files with 151 additions and 7 deletions
@@ -0,0 +1,63 @@
"""Draw the walk-depth labelling and cut of a medial tire decomposition.
Paper-graphics companion to ``run_medial_tire_cut_experiment.py``: it imports
``run_experiment`` from there, runs the pipeline on a random maximal planar
graph, and emits a TikZ ``tikzpicture`` (walk-depth labels + cut slits) for each
recognised full medial tire graph of the decomposition, using ``to_tikz`` from
``medial_tire_cut_labelling``.
This script only renders; the experiment itself draws nothing. Run with the
repo venv (networkx): ``.venv/bin/python``.
Example:
.venv/bin/python draw_medial_tire_cut.py -n 20 --seed 72 > panels.tex
"""
from __future__ import annotations
import argparse
import os
import sys
_HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, _HERE)
from run_medial_tire_cut_experiment import run_experiment # noqa: E402
from medial_tire_cut_labelling import to_tikz # noqa: E402
def tikz_panels(n: int, seed: int, scale: float = 1.6) -> tuple[dict, list[str]]:
"""Run the experiment and return ``(result, panels)``, one TikZ panel per
recognised tread, each showing that tread's walk-depth labelling and cut."""
result = run_experiment(n=n, seed=seed)
panels = []
for d in sorted(result["results"]):
rec = result["results"][d]
panels.append(to_tikz(rec["g"], depth=rec["depth"], cuts=rec["cuts"],
entry_edge=rec["entry_edge"], scale=scale))
return result, panels
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("-n", type=int, default=20)
parser.add_argument("--seed", type=int, default=72)
parser.add_argument("--scale", type=float, default=1.6)
args = parser.parse_args()
result, panels = tikz_panels(args.n, args.seed, scale=args.scale)
treads = sorted(result["results"])
print(f"% medial tire cut: n={args.n} seed={args.seed} "
f"source={result['source']} recognised treads={treads}")
if not panels:
print("% (no recognised full medial tire graphs for this graph)")
for d, panel in zip(treads, panels):
g = result["results"][d]["g"]
print(f"% --- tread {d}: |A(T)|={g.n} word={g.tooth_word} "
f"bites={sorted(g.bites)} ---")
print(panel)
if __name__ == "__main__":
main()
+4 -1
View File
@@ -11,14 +11,17 @@
\newlabel{ex:worked-cut}{{2.3}{2}} \newlabel{ex:worked-cut}{{2.3}{2}}
\@writefile{toc}{\contentsline {section}{\tocsection {}{3}{Chaining across the tire tree}}{2}{}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\tocsection {}{3}{Chaining across the tire tree}}{2}{}\protected@file@percent }
\citation{bauerfeld-medial-tire} \citation{bauerfeld-medial-tire}
\bibcite{bauerfeld-medial-tire}{1}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces A full medial tire graph (left) and its walk-depth labelling and cut (right), from Example\nonbreakingspace 2.3\hbox {}. Black vertices are the annular medial vertices of the cycle $A(T)$; blue vertices are up-tooth apexes, red vertices are down-tooth apexes, and the larger red vertex is the shared apex of the bite on annular edges $0$ and $4$. On the right, each tooth carries its walk depth, and the two red slits mark the cuts: \emph {cut\nonbreakingspace 1} duplicates $a_5$ as the root-face traversal closes, and \emph {cut\nonbreakingspace 2} duplicates $a_1$ as the bite's inner-gap face closes. After the cuts the only bounded faces are the eight teeth.}}{3}{}\protected@file@percent } \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces A full medial tire graph (left) and its walk-depth labelling and cut (right), from Example\nonbreakingspace 2.3\hbox {}. Black vertices are the annular medial vertices of the cycle $A(T)$; blue vertices are up-tooth apexes, red vertices are down-tooth apexes, and the larger red vertex is the shared apex of the bite on annular edges $0$ and $4$. On the right, each tooth carries its walk depth, and the two red slits mark the cuts: \emph {cut\nonbreakingspace 1} duplicates $a_5$ as the root-face traversal closes, and \emph {cut\nonbreakingspace 2} duplicates $a_1$ as the bite's inner-gap face closes. After the cuts the only bounded faces are the eight teeth.}}{3}{}\protected@file@percent }
\newlabel{fig:worked-cut}{{1}{3}} \newlabel{fig:worked-cut}{{1}{3}}
\newlabel{rem:chaining-candidates}{{3.1}{3}} \newlabel{rem:chaining-candidates}{{3.1}{3}}
\newlabel{ex:real-cut}{{3.2}{3}}
\bibcite{bauerfeld-medial-tire}{1}
\newlabel{tocindent-1}{0pt} \newlabel{tocindent-1}{0pt}
\newlabel{tocindent0}{12.7778pt} \newlabel{tocindent0}{12.7778pt}
\newlabel{tocindent1}{17.77782pt} \newlabel{tocindent1}{17.77782pt}
\newlabel{tocindent2}{0pt} \newlabel{tocindent2}{0pt}
\newlabel{tocindent3}{0pt} \newlabel{tocindent3}{0pt}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces The recognised tread $T_2$ of the medial tire decomposition of a random maximal planar graph on $20$ vertices (Example\nonbreakingspace 3.2\hbox {}), with its walk-depth labelling and cut. Black vertices are the annular medial vertices of $A(T)$; blue vertices are up-tooth apexes and red vertices down-tooth apexes, the larger red vertex being the shared apex of the bite on annular edges $2$ and $5$. Each tooth carries its walk depth; the red slits are the two cuts.}}{4}{}\protected@file@percent }
\newlabel{fig:real-cut}{{2}{4}}
\@writefile{toc}{\contentsline {section}{\tocsection {}{}{References}}{4}{}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\tocsection {}{}{References}}{4}{}\protected@file@percent }
\gdef \@abspage@last{4} \gdef \@abspage@last{4}
+6 -6
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) 14 JUN 2026 23:46 This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.10.5) 14 JUN 2026 23:54
entering extended mode entering extended mode
restricted \write18 enabled. restricted \write18 enabled.
%&-line parsing enabled. %&-line parsing enabled.
@@ -500,10 +500,10 @@ LaTeX Warning: `h' float specifier changed to `ht'.
[2] [3] [4] (./paper.aux) ) [2] [3] [4] (./paper.aux) )
Here is how much of TeX's memory you used: Here is how much of TeX's memory you used:
13648 strings out of 478268 13652 strings out of 478268
272620 string characters out of 5846347 272685 string characters out of 5846347
558283 words of memory out of 5000000 559301 words of memory out of 5000000
31477 multiletter control sequences out of 15000+600000 31481 multiletter control sequences out of 15000+600000
477049 words of font info for 58 fonts, out of 8000000 for 9000 477049 words of font info for 58 fonts, out of 8000000 for 9000
1302 hyphenation exceptions out of 8191 1302 hyphenation exceptions out of 8191
84i,9n,89p,801b,704s stack positions out of 10000i,1000n,20000p,200000b,200000s 84i,9n,89p,801b,704s stack positions out of 10000i,1000n,20000p,200000b,200000s
@@ -521,7 +521,7 @@ msy10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cm
ti10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmt ti10.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmt
i8.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt1 i8.pfb></usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt1
0.pfb> 0.pfb>
Output written on paper.pdf (4 pages, 176366 bytes). Output written on paper.pdf (4 pages, 180590 bytes).
PDF statistics: PDF statistics:
85 PDF objects out of 1000 (max. 8388607) 85 PDF objects out of 1000 (max. 8388607)
52 compressed objects within 1 object stream 52 compressed objects within 1 object stream
Binary file not shown.
+78
View File
@@ -309,6 +309,84 @@ graph, tire decomposition at a vertex level source, and chained walk-depth
labelling and cut---is carried out by the experiment script labelling and cut---is carried out by the experiment script
\texttt{experiments/run\_medial\_tire\_cut\_experiment.py}. \texttt{experiments/run\_medial\_tire\_cut\_experiment.py}.
\begin{example}[A medial tire cut from a random graph]
\label{ex:real-cut}
Run on a random maximal planar graph on $20$ vertices (seed $72$, level
source vertex $9$), the experiment yields a single recognised tread
$T_2$, drawn in Figure~\ref{fig:real-cut} with the walk-depth labelling
and cut emitted by the graphics companion
\texttt{experiments/draw\_medial\_tire\_cut.py}. Its annular cycle has
length $8$, with up teeth on annular edges $0,3,4$, singleton down teeth
on $1,6,7$, and a bite on the non-incident annular edges $2$ and $5$ (the
central shared apex). Entering at the up tooth on edge $0$ with walk
depth $0$, the root face is labelled in order ($0,1,2$ then $3,4,5$) and
\emph{cut~1} duplicates $a_0$ as it closes; the walk then descends through
the bite into its inner-gap face, labelling the two teeth there ($6,7$),
and \emph{cut~2} duplicates $a_3$ as that face closes. The two cuts leave
only the outer face and the eight teeth as $3$-faces.
\end{example}
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=1.6,
ann/.style={circle, fill=black, inner sep=1.0pt},
upv/.style={circle, draw=blue!70!black, fill=blue!12, inner sep=1.4pt},
downv/.style={circle, draw=red!70!black, fill=red!12, inner sep=1.4pt},
bitev/.style={circle, draw=red!70!black, fill=red!32, inner sep=1.7pt},
cyc/.style={black, line width=1.0pt},
tth/.style={black!55, line width=0.4pt},
lbl/.style={font=\scriptsize},
dlbl/.style={font=\scriptsize\bfseries, text=black},
cut/.style={red!80!black, line width=1.3pt},
cutlbl/.style={font=\tiny, text=red!75!black}]
\draw[cyc] (0.000,1.000)--(0.707,0.707)--(1.000,0.000)--(0.707,-0.707)--(0.000,-1.000)--(-0.707,-0.707)--(-1.000,-0.000)--(-0.707,0.707)--cycle;
\draw[tth] (0.559,1.349)--(0.000,1.000) (0.559,1.349)--(0.707,0.707);
\draw[tth] (0.559,-1.349)--(0.707,-0.707) (0.559,-1.349)--(0.000,-1.000);
\draw[tth] (-0.559,-1.349)--(0.000,-1.000) (-0.559,-1.349)--(-0.707,-0.707);
\draw[tth] (0.554,0.230)--(0.707,0.707) (0.554,0.230)--(1.000,0.000);
\draw[tth] (-0.554,0.230)--(-1.000,-0.000) (-0.554,0.230)--(-0.707,0.707);
\draw[tth] (-0.230,0.554)--(-0.707,0.707) (-0.230,0.554)--(0.000,1.000);
\draw[tth] (0.000,-0.318)--(1.000,0.000) (0.000,-0.318)--(0.707,-0.707);
\draw[tth] (0.000,-0.318)--(-0.707,-0.707) (0.000,-0.318)--(-1.000,-0.000);
\node[ann] at (0.000,1.000) {};
\node[ann] at (0.707,0.707) {};
\node[ann] at (1.000,0.000) {};
\node[ann] at (0.707,-0.707) {};
\node[ann] at (0.000,-1.000) {};
\node[ann] at (-0.707,-0.707) {};
\node[ann] at (-1.000,-0.000) {};
\node[ann] at (-0.707,0.707) {};
\node[upv] at (0.559,1.349) {};
\node[upv] at (0.559,-1.349) {};
\node[upv] at (-0.559,-1.349) {};
\node[downv] at (0.554,0.230) {};
\node[downv] at (-0.554,0.230) {};
\node[downv] at (-0.230,0.554) {};
\node[bitev] at (0.000,-0.318) {};
\node[dlbl] at (0.456,1.101) {0};
\node[dlbl] at (0.704,0.292) {1};
\node[dlbl] at (0.427,-0.336) {2};
\node[dlbl] at (0.456,-1.101) {7};
\node[dlbl] at (-0.456,-1.101) {6};
\node[dlbl] at (-0.427,-0.336) {3};
\node[dlbl] at (-0.704,0.292) {4};
\node[dlbl] at (-0.292,0.704) {5};
\draw[cut] (0.000,0.840)--(0.000,1.160);
\node[cutlbl] at (0.000,1.300) {cut 1};
\draw[cut] (0.594,-0.594)--(0.820,-0.820);
\node[cutlbl] at (0.919,-0.919) {cut 2};
\node[lbl, text=blue!60!black] at (0.689,1.663) {entry};
\end{tikzpicture}
\caption{The recognised tread $T_2$ of the medial tire decomposition of a
random maximal planar graph on $20$ vertices
(Example~\ref{ex:real-cut}), with its walk-depth labelling and cut. Black
vertices are the annular medial vertices of $A(T)$; blue vertices are
up-tooth apexes and red vertices down-tooth apexes, the larger red vertex
being the shared apex of the bite on annular edges $2$ and $5$. Each
tooth carries its walk depth; the red slits are the two cuts.}
\label{fig:real-cut}
\end{figure}
\begin{thebibliography}{9} \begin{thebibliography}{9}
\bibitem{bauerfeld-medial-tire} \bibitem{bauerfeld-medial-tire}