Latex labels for Graphviz (work in progress)

A year ago in Linear Algebra 1 lecture (I study Mathematics in my 60s) I created a big structure diagram with Graphviz.

Now I wanted to create a similar structure diagram for Elementary number theory lecture, but hesitated. Reason was that a year ago I had to lookup each and every Latex symbol, determine unicode and use that in Graphviz HTML label. I did not want to do that again.

So I played with Google Gemini (only today) and it had more problems with the code than for mathematical software or GPU code. But after many many iterations now a nice tool implementing the subject line is available:
https://gist.github.com/Hermann-SW/12c7644ac0c75b4eb019f76c3f023fe5

More details in the gist, below as teaser just the layout of current gist — I like it.
This is how easy Latex can be used for Graphviz labels (Latex cases environment does work!):

...
thm_3_47_label = latex_to_graphviz_html(
r"""\textbf{Thm 3.47 }For cyclic group G:\ G \cong \begin{cases}
\mathbb{Z} & \text{for }G\text{ infinite,}\
\Z /|G|\mathbb{Z} & \text{for }G\text{ finite.} \end{cases}"""
)

ex_3_48_label = latex_to_graphviz_html(
r"""\textbf{Ex 3.48 } (\Z/5\Z)^{\times} \cong \Z/4\Z\ \psi: \begin{cases}
\Z/4\Z &\to\ (\Z/5\Z)^{\times}\
a &\mapsto\ \bar{2}^a \end{cases}\lbr"""
)
...
    thm_3_47 [label={thm_3_47_label}];
    ex_3_48 [label={ex_3_48_label}];
...

Layout created:

I did search for similar projects and found some never completed and terminated decades ago.
Comments/wishes appreciated.

Cool!

Yes — I continued and completed adding (translated) sections 3.3 “prime residue classes and Fermat-Euler theorem” and 3.4 “cyclic groups” of (German language) lecture script sitting behind Heidelberg University VPN. From definition 3.13 until theorem 3.49.

If X is referred to in Y, solid edge X->Y is added.

For eg. propositions with no incoming edges I determined dotted edge where reference in script text is missing. For nodes having no outgoing edges, I added at most two dotted links, one to next example where applicable, and one for proposition/theorem/corollary if applicable.

Below is 10× scaled down screenshot, and created PDF.

In browser all labels look nice for me with 75% scaling. Searching for eg. “ord(” gives 7 hits, and clicking on one of them on left list moves view to corresponding node. Really useful for working with that graph! The gist from initial post was updated.