Graphviz in Rust!

(not my work, though I am rusty)
GitHub - nadavrot/layout: Layout is a rust library and a command line tool that renders Graphviz dot files. and Show HN: A Graphviz Implementation in Rust | Hacker News

1 Like

Impressive. I particularly enjoy the idea of visual debug output (even if I don’t really know what the dots mean. probably spline control points?)

Graphviz could adopt this idea, too. It might need some modest graphics driver extensions. There was an obscure feature showboxes to emit spline router control polygons, but it only worked with the native Postscript driver; IIRC it required diverting stderr to a file and catting that onto the Postscript layout, and had other limitations. The authors used it to debug the Spline-o-matic.

It is probably not too hard to expose showboxes as a proper command line option that does the file cat/merge itself.

Showing control points is easy (Fun with edges!).
Changing control points (or knowing where you want them to be), that is the hard part.

  • interactively tweaking control points might be nice on a onesey basis, but would probably turn to chaos quickly
  • providing a menu (interactive or not) of possible control point tweaks might also help, but I can’t figure out how to keep symmetry when arrowheads are involved.

The thing that Graphviz users repeatedly ask for (explicitly or implicitly) is layout explainability. By this I mean to unify:

  • “why did I change this one minor thing in my input and my output radically changed?”
  • “I want the exact output Graphviz produced, with this one slight tweak”
  • “how do I inject my custom requirements into Graphviz?”

Does this remind anyone else of program debugging? I write my .dot program and Graphviz is the interpreter that runs my program. So why can’t I add break points? Why can’t I single-step layout? Why can’t I ask what source line was responsible for the current action? In short, where is my Graphviz gdb?

:thinking:: “You’re seriously putting forth gdb as a state-of-the-art debugger as an aspiration?”
No.

:thinking: “…but you’re saying gdb is better than the current state-of-the-art Graphviz debugging?”
Well…

It would be nice to have an option to generate a lot of geometric annotation to show the geometric structures that underlie the layout that is generated.

Also, it would be great to generalize the layout framework and rewrite the top level in a more accessible language and only resort to C or math libraries when needed.

Also it should be dynamic, see dyngraph.org, which spun off graphviz.

Make that: https://www.dynagraph.org/