Live data from Hacker News

Create diagrams with code using Graphviz

ncona.com

191–200 of 221 posts

Re: Create diagrams with code using Graphviz

#191

Earlier quoted context omitted.

Better integration with TeX, I want to put formulas inside the graph using the exact same fonts as in the rest of my paper.

I'm not a TeX user, are you asking for: 1. TeX output file format, but with current font drivers 2. Current output file formats, but with TeX fonts 3. TeX output with TeX fonts 4. Something else

I'm asking for an easy way to use the same fonts with exactly the same size in both places, I do not really care how it is implemented. Maybe it is already possible and the only missing thing is the documentation to do so. I can do it via some pstricks hackery, and it sort of works, but the process is a bit indirect and not really comfortable.

Re: Create diagrams with code using Graphviz

#192

Earlier quoted context omitted.

> - find someone to donate a generic orthogonal routing algorithm based on a modern algorithm since people want this > - it would be a big effort, but move the core algorithms to a framework that supports interaction with layout generation Yup, I think these are the ones that mean I never actually end up using Graphviz for anything :) If I'm generating graphs, I want them laid out in a hierarchical style. To do that,…

So what library do you use for hierarchical layouts?

Not OP, but I find yEd by yworks is a really good editor, and they also have a really cool developer library yFiles for HTML. It’s all proprietary, but just amazing to work with. Here’s an example of what you can do they made for GDC2019: https://live.yworks.com/demos/promo/GDC2019/ (It’s not mobile friendly however).

Re: Create diagrams with code using Graphviz

#193
post #158

Earlier quoted context omitted.

> - better default styles that don't look like troff from 1985 Design is not something that should be tied to a particular decade. It's not fashion. Good design is timeless and only adopts to new technologies/media. Design is how well a particular solution works for the purpose of it. If it looks like 1985 and works well, there is absolutely no reason to change it. If it doesn't, then there is no need to look at "mod…

> it’s not fashion Many would argue good fashion is timeless as well. A good chunk of haute couture from decades past would be seen as modern and appealing today. (Which is why the houses like to repackage and ship them as such...)

> A good chunk of haute couture from decades past would be seen as modern and appealing today.

But not at every given point in time. That fashion ebbs and flows is a given, but that's not the same thing as being timeless.

Re: Create diagrams with code using Graphviz

#194
post #30

Earlier quoted context omitted.

Does it have graph-drawing included?

That's one of its main uses. One thing it does not do (or I don't know how) and graphviz does, though, is arranging nodes intelligently so as to minimize clutter and edge distances. That's one of the nice things in graphviz.

A library of pgf/tikz that requires lualatex can do graph drawing. It is called "graphdrawing" actually. It can do the layout automatically and so on. You can add new automatic layouts using lua.

It's described in part IV of the pgf manual.

Re: Create diagrams with code using Graphviz

#195

We're reluctant to be exposed to too much anger about misfeatures in 20 year old code that was basically a prototype that escaped from the lab, but go ahead, ask us anything. We've gotten a lot of help lately from Magnus Jacobsson, Matthew Fernandez and Mark Hansen on cleaning up the website and the code base, even some persistent bugs we could never find ourselves. Improvements that would benefit the community the m…

I'd rather have graphviz expose a kind of layout engine such that it can take the size each node will occupy (determined by whatever's going to draw them) and use that to create a layout, feeding path info to something that can handle the actual drawing, than have more drawing options in Graphviz itself. I think that doing so is (so far as I could tell, last time I tried) extremely awkward at best is why it's not emb…

Doesn't the export to plain give you what you need in term of location and size of the different items?

https://graphviz.org/doc/info/output.html#d:plain

Re: Create diagrams with code using Graphviz

#196

Earlier quoted context omitted.

So what library do you use for hierarchical layouts?

Not OP, but I find yEd by yworks is a really good editor, and they also have a really cool developer library yFiles for HTML. It’s all proprietary, but just amazing to work with. Here’s an example of what you can do they made for GDC2019: https://live.yworks.com/demos/promo/GDC2019/ (It’s not mobile friendly however).

(yWorks employee here, having worked on that Graph Drawing Contest)

Thank you for the kind words.

I've tried to make it mobile-friendlier, after our marketing team told me that most people who come via Twitter use a phone. But we kinda ran out of time, so I only managed to fix the most egregious problems. By now I also have a few ideas how to get the edge paths to be much better (and built-in Bézier spline routing would have helped, but that was only released publicly ... two days ago). Admittedly, while that layout has been produced by yFiles' hierarchical layout it needed a bit massaging to do so properly (about 200 lines of custom layout code, if I remember correctly). However, a proper library that gives you that flexibility helps tremendously, of course. Sometimes, trying to get Graphviz to do the right thing can be pretty complicated and may involve hacks like invisible edges to force a certain layering (although that was way back and I didn't know about "rank=foo" back then; perhaps the invisible edges were really not needed).

In any case, yEd Live (https://www.yworks.com/yed-live/), built on yFiles for HTML, also has an undocumented, incomplete, and rudimentary Graphviz import. I've got a fairly exhaustive list of issues and missing features, but little time to tackle it, sadly. This is further complicated by the fact that the DOT language uses attributes to describe the graph structure, visual attributes of items, and to control layout settings. That makes mapping Graphviz to anything else a bit hard.

Re: Create diagrams with code using Graphviz

#197

What I've been craving for is a way to respect the order of the nodes when being drawn. Since currently it re-orders them to occupy less space. With this I would be able to finish my data flow diagram out of a functional programming project. To describe in a visual way how the function calls are happening.

You can use "rank" to force the ordering.

Re: Create diagrams with code using Graphviz

#198
post #41

I ended up with a different tool, but I was uncomfortable using drawing apps for diagrams, and only rarely included them in my blog until I could use text to define them. I’m all-in on Markdown + Github for writing, so working with text-driven diagrams is a natural fit.

What tool did you use? I’ve been using mermaid and its markdown plug-ins and like it quite a bit, but am always looking for new ways.

I am also using mermaid. Like Markdown, it has a ton of shortcomings. But just like Markdown, the big win is that it forces me to keep things simple.

Markdown forces me to focus on just the words, not the layout and fancy formatting. Mermaid does the same thing for diagrams: Anything I can draw with a pencil but can't express in Mermaid must be simplified or broken into separate sub-diagrams.

This would be terrible if I was trying to draw a diagram of the entire infrastructure of a modern SaaS company, but is actually good when I am trying to write a post explaining ideas: Multiple simple diagrams interspersed with text get the job done.

Re: Create diagrams with code using Graphviz

#199
Graphviz got me a company paid trip to Orlando back in 2003. I built a Perl script that parsed a firewall configuration file to produce a visualisation of the policy and relationships between the various entities like network addresses, protocols and so on. My abstract I wrote on it was good enough to be selected to attend our company technical conference, but fortunately not so good that I would have to write a full paper add present ;-)

Re: Create diagrams with code using Graphviz

#200
post #18

I’d like to write some scripts that can take some of my code and produce a graph of it. Things I’d like is for example to draw a GCP cloud build file, or something like that. What would be a good intermediate format for this? I’ll read an xml or yaml file into a python list of dicts and then loop through it and write ... Graphviz? Mermaid? Tikz? What do you guys recommend?

Using graphviz for visualizing these things is fast and easy. print('digraph foo {') # adj_list contains tuples of (parent node name, child node name) for parent, child in adj_list: print(f'{parent} -> {child}') print('}') Redirect that to a file and view with `xdot`, done. I've done exactly this a few days ago to visualize the Linux build graph: https://q3k.org/u/73839114a0e5ee65002029892a069dd1b645a8f9f0...

Sweet! It was excactly this kind of advice I was hoping to get. Thank you.
Post reply on HN