Hacker News

vismit2000
Mastering Layout Engines in Graphviz: Dot vs. Neato vs. Twopi vs. Circo guides.visual-paradigm.com

AceJohnny23 days ago

Tangentially, I must highlight the underrecognized gvpr [1], the Graphviz Pattern Scanning and Processing Language and part of any Graphviz installation. In short, it is an AWK-like program to process your .dot files.

Combined with the fact that the DOT syntax allows for gradual precision, in that you can add directives to an existing DOT document to add details (shape, positioning...), and you can do pre-processing of a graph before passing it to the final layout and rendering engine.

(In fact, you could probably implement all of the linked layout engines in gvpr)

I used this at some point to generate a Factorio processing graph, organizing each layer by its minimum production depth (ie ores at layer 1, plates at layer 2, etc...)

[1] https://graphviz.org/docs/cli/gvpr/

frumiousirc2 days ago

Thanks! I've used graphviz for more than a decade and had never learned of gvpr.

meh2frdf3 days ago

I’ve been working in this area recently, none of the layout engine are very good, they essentially apply the same algorithm to all the things when really a graph is often a collection of different patterns and what makes sense is often semantics driven. So yes built my own, the use case is representing cloud and enterprise architectures. Have a decent layout engine now, and created a declarative dsl for the agent to interact with, but the agent sucks, feels like we need to hand roll a lot of features/skills

aezart3 days ago

I occasionally use graphviz and pretty much always wind up frustrated with it. The syntax is pedantic and the resulting output is pretty ugly for all but the simplest graphs.

recursivecaveat3 days ago

What's your use case for it? For manual diagrams, making an explanatory diagram for a presentation or something I would never recommend it. Declaratively typing out all your information is going to take just as long as setting it directly in drawio, but with less control over the result.

Where graphviz/dot has always shined for me is you have some application built around a data flow graph and occasionally need to debug a run with 50+ nodes at a time. So you write a file dumper for your structure. A visual makes understanding the structure so much faster, and nothing else seems to produce layouts nearly as good as dot.

aqula2 days ago

There's also ELK that I found gave the best results. Checkout some diagrams generated here - https://arcaide.foo/app/projects

futune2 days ago

Which ones of these are generated by ELK? All of them?

aqula2 days ago

Yes, they all are.

tamimio3 days ago

I tried most of these declarative diagrams, while they work to some degree, the best outcome I had was with drawio but you should have the skill installed.

VorpalWay3 days ago

Depends on your use case. If i want to export some graph data structure from a program to visualise it for debugging purposes, graphviz is way more relevant than doing it by hand in drawio.

But if I'm making a presentation for a conference I would choose differently. And in between you get a whole spectrum of tradeoffs.

brians3 days ago

If you don't even explain neato vs fdp, what's the point?

compiler-guy3 days ago

It's a sales website with a not-terrible hook.

Also AI generated diagrams with strange labelling doesn't persuade me much.

yhwirkhwh2 days ago

Thhhw

hn-front (c) 2024 voximity
source