Live data from Hacker News

LaTeX Finite Automata and State Diagrams with Tikz

hayesall.com

21–30 of 36 posts

Re: LaTeX Finite Automata and State Diagrams with Tikz

#21
post #5

I find manually laying out graphs and digraphs tedious. It seems like a problem that should be amenable to machine learning approaches. Basically, training a machine as to what is an aesthetically pleasing layout and what is not. Are there layout engines that use machine learning for layout, as against being implemented in terms of specific tree or graph layout algorithms?

I don't think the difficulty in making diagrams has to do creating a layout that is aesthetically pleasing, but rather with expressing ideas visually in a way that others can understand them. I'm sceptical that AI can help with that.

Re: LaTeX Finite Automata and State Diagrams with Tikz

#22
post #21
post #5

I find manually laying out graphs and digraphs tedious. It seems like a problem that should be amenable to machine learning approaches. Basically, training a machine as to what is an aesthetically pleasing layout and what is not. Are there layout engines that use machine learning for layout, as against being implemented in terms of specific tree or graph layout algorithms?

I don't think the difficulty in making diagrams has to do creating a layout that is aesthetically pleasing, but rather with expressing ideas visually in a way that others can understand them. I'm sceptical that AI can help with that.

I'm pretty confident that it could be a good improvement over the currently used spring models. Give me three high-distance options that ML thought were good, I'll probably choose one over laying out manually.

Re: LaTeX Finite Automata and State Diagrams with Tikz

#23

So repulsed by this. Learning custom DSL with opaque semantics that will leave you scratching your head when something goes wrong and tool behaves not like you expect. Why people opt into such tools at all?

Because it's the same tool that you're already writing the paper in.

Re: LaTeX Finite Automata and State Diagrams with Tikz

#24
post #2

I loved using Tikz for my Discrete Math homework. I was so proud of how pretty the DFA's looked :)

I used OmniGraffle and got some pretty fine looking graphs myself, but this is next-level ease. I’m jealous that you knew how to use this.

I used tikz to make figures when I decided typesetting some of my physics notes was a good idea. Like any programming language/dsl, you start small and work your way up. Fortunately, there were a ton of examples and the manual is gigantic

Re: LaTeX Finite Automata and State Diagrams with Tikz

#25

So repulsed by this. Learning custom DSL with opaque semantics that will leave you scratching your head when something goes wrong and tool behaves not like you expect. Why people opt into such tools at all?

TikZ & pgfplots are really nice if you get over the initial learning curve and prefer programmatically defining things rather than drawing by hand.

E.g. in my theses all figures (except one in my first thesis) were made with TiKZ with colors and definitions defined in a file that is "imported" during compilation.

This allowed me to fine tune various parts (colors, ...) without having to touch each figure again. Also, all the data files are stored as CSV and read/processed by LaTeX. Between handing in my thesis and publishing the short-paper version of it for a conference I could rerun my analysis (to include the most recent data) with a single command and then just recompile the document to have all figures updated.

The thesis: https://www.ac.tuwien.ac.at/files/pub/hinteregger_18.pdf

And TikZ graphics play somewhat nice with the beamer package. I found it easier to define transitions in technical figures with TikZ/beamer than with PowerPoint or any other tool so far.

In a summer internship I worked on the documentation of a project that tried to optimize pillar-placement for skilifts. This was very Math/Physics heavy.

With TikZ I could define various parts (e.g. pillar, rope, gondola) as "function" and then create figures that combined these parts.

I.e: - place pillars at these locations - connect them with ropes obeying some formula - put gondolas along the rope with some defined distance

Important points where marked with coordinates automatically, allowing explanatory nodes (text box with arrow or paths with labels) to be added (with full LaTeX support).

Re: LaTeX Finite Automata and State Diagrams with Tikz

#26
post #20

One of the elephants in the room of laying out node-arc diagrams is just how bad Graphviz is at the task. This sort of thing should be a core use case for Graphviz and it just isn't a good tool. If anyone writes a Graphviz tutorial, it would be doing the world a service to prefix it with "But seriously, note that Tikz exists".

Do you mean that the graphs don't look good? They layout seems good, to me.

I have a Theory of Computation text so I have many, many such diagrams. I don't rely on the graphviz output directly. If I have to make a graph where the layout isn't obvious then I write a .dot file and run it through graphviz, specifically, neato. I use that as a model for drawing it with a LaTeX tool (I don't use TikZ, I use Asymptote, but the point is the same). That way I get a pretty good layout, better then I personally could do without the guidance from graphviz, and a visual consistency to the diagrams.

Re: LaTeX Finite Automata and State Diagrams with Tikz

#27
post #19
post #5

I find manually laying out graphs and digraphs tedious. It seems like a problem that should be amenable to machine learning approaches. Basically, training a machine as to what is an aesthetically pleasing layout and what is not. Are there layout engines that use machine learning for layout, as against being implemented in terms of specific tree or graph layout algorithms?

It would be nice if there were a tool that would take the input to graphviz, run it to graphviz to get the layout and then use that to generate the tikz code using that layout.

Years ago I wrote and contributed a backend to graphviz that output MetaPost (I just had a look and don't see it in the source anymore). It was very easy; I found another backend and made a few tweaks. Perhaps you might have a look?

Re: LaTeX Finite Automata and State Diagrams with Tikz

#28

On this topic, I recently came across a nice string diagram formalization for automata: https://arxiv.org/pdf/2009.14576.pdf

Neat.

If I understand correctly, their work makes diagrams and code isomorphic. Meaning roundtripping between diagrams and code can be done with no loss, no impedance mismatch.

Meaning my long-time dream of a two-way structure editor is now feasible. Edit the diagram, the code updates. Edit the code, the diagram updates. Back and forth.

As you know, the Achilles Heel of CASE tools (and visual programming) has been the inability to roundtrip.

Do I understand correctly?

My science-fu is weak. I've been struggling to wrap my head around grammars and whatnot my entire career. Please forgive.

Re: LaTeX Finite Automata and State Diagrams with Tikz

#29
How does this compare to Penrose?

Also, has anybody tried using Inkscape [1,2] or another vector drawing tool for this? I imagine it would be faster and more intuitive than learning Tikz.

[1] - https://stackoverflow.com/questions/17610717/drawing-an-undi...

[2] - The following appears to be part of a presentation: https://gould.cx/ted/presentations/txlf16/Technical%20Drawin...

Re: LaTeX Finite Automata and State Diagrams with Tikz

#30
post #5

I find manually laying out graphs and digraphs tedious. It seems like a problem that should be amenable to machine learning approaches. Basically, training a machine as to what is an aesthetically pleasing layout and what is not. Are there layout engines that use machine learning for layout, as against being implemented in terms of specific tree or graph layout algorithms?

TikZ claims some support for automated graph layout generation in chapter 26 of the manual [1]. It also lets you specify your own graph layout algorithms in Lua. Results in my experience aren't as aesthetic or intuitive as a custom layout but are comparable to graphviz.

[1] https://tikz.dev/gd-overview

edit: chapter 27 in the online version

Post reply on HN