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 most?
- better default styles that don't look like troff from 1985
- better default layout parameters in neato than statistical multidimensional scaling based on shortest path
- more expressive graph language with classes or templates
- more robust handling of error conditions like out of memory
- better documentation to help people find useful tools or just know what they should be looking for
- 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
I love graphviz and have used it as part of my job for over 15 years.
That said, I have spent entirely too much time manually searching through the 100-odd dimensional Graphviz parameter space trying to get aesthetic results. So much time in fact that occasionally it's easier to fire up Omnigraph and draw the thing manually.
Graphviz would be ideal if it had some kind of meta-parameter settings that could reduce the tendency of its output to resemble an unreadable rats nest when the number of nodes exceeds about 20. I know that's part of the point of neato vs. dot, and that some parameters are effectively meta-parameters, but Graphviz still needs a better "porcelain" (in git-speak) with fewer dimensions.
This is an excellent idea. In general, allowing a human to say they would like to expend more machine cycles to search for better renderings would be useful. This would be an interesting summer intern project, It could probably be layered on top of the existing software.
I've had the same experience. What could help is a constraints-driven drawing, i.e. we could split the drawing space into an invisible grid and say that these nodes must be in cell 1, those nodes in cell 2 and so on.
Been using graphviz on and off for ~20^H^H15 years (seems like 20) and it was my introduction to graph theory and concepts. Just wanted to thank the team for maintaining an incredibly useful and versatile tool.
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 embedded in basically everything that has any need whatsoever to draw graphs.
So, I guess:
> - it would be a big effort, but move the core algorithms to a framework that supports interaction with layout generation
If that's what you mean by that.
It'd make it way easier to pretty up Graphviz output. I'd rather have "renderer" applications that run on top of Graphviz and have Graphviz itself lose all but its most basic build-in drawing capabilities, than have more of that built into Graphviz itself.
One problem with this is that—at least in some Graphviz layout engines—"the size each node is going to occupy" is chosen to minimize the energy/stress of the graph, sort of like how line breaks on TeX pages are chosen to optimize for whole-page metrics.
For example, in a graph with only two nodes, where each node contains a long text string, there is no "pressure" on the nodes, so the default result might be to not break the text, creating two wide, short node-boxes, and then to arrange them with one above the other. Whereas if you have many such nodes in a densely-connected web, the text in them will likely be wrapped in order to make the nodes more box-shaped, so that nodes can fit between the cuts of the pairwise-acute spirograph-like edge lines.
In order to resolve this sort of layout, Graphviz has to understand a lot of things about fonts, padding, and borders (just like TeX does.) It's already doing "rendering" at that point, even if the result gets thrown away.
I have used Graphviz that way. It wasn't too bad. The most annoying part was inconsistency in input and output units. Some properties expect values in pixels, some are in inches, and dpi for input and output are different with only one of them being configurable.
Otherwise code was quite straight-forward: create context, create nodes, create edges, set attributes, run layout, read positions and edge path coordinates, do the cleanup.
That doesn't let you tell graphviz how large you want to draw each node, right? Just how large graphviz would draw them? What I'd like is a way to take styling and drawing outside GraphViz. It's important (for what I'd like) that graphviz know how large each node is going to be so it can route around them. If you apply, say, a typeface or padding even very slightly different than what graphviz was using, or if there are just slight differences in, say, how a given browser renders a <div>, it could change the size of the rendered nodes, and you end up with edges drawn under/over nodes.
Much cleaner (and way more useful) to be able to tell graphviz "this is how large I need this node to be, and that one this size, and the other one such-and-such, and they are connected thusly, now please give me coords for a layout"
This isn't just for looks, either: if you want the resulting graph to be interactive, and perhaps even graphically (drag-n-drop) editable after the initial graphviz auto-arranging, you're probably wanting output that's not exactly in graphviz's wheelhouse. You want to tell it node sizes and have it tell you where to put them.
Hey there, I'm the owner of webgraphviz.com and I am totally excited to see that it made it to the front page of hackernews!!
THANK YOU for making this wonderful program.
Also special thanks to the emscripten team for their wonderful transcompiler.
I am constantly amazed at all the WONDERFUL software that exists on unix as single threaded applications (required for emscriptem asm.js output). There could be a whole sub-culture of webdev which uses these old unix programs. I feel like it's an untapped resource, truly.
Agreed 100%. I don't care if graphviz looks a bit dated -- it's straightforward and easy to generate. (I wouldn't say "no" to having more layout algorithms, though!)
My favourite personal use of Graphviz: A few years ago I inherited a large, legacy codebase that was very hard to understand -- full of global state modified from dozens of functions, obscure function names, etc. I used a C parser (forget which one) to convert the code to a set of ASTs, and then hacked up a Web-based, interactive graph generator, using Graphviz to create the interactive SVGs. The "app" let you click on a function (node) and zoom in to examine its callers, callees, global accesses, global mutations, etc., with a "radius" parameter to decide how much of the large graph you wanted to see. Every node was clickable, and would ask the Web app to generate a new graph centered on that node.
It was an awful, throwaway hack, and was only about 90% accurate due to parsing/preprocessor challenges. (At times I resorted to annotating the code with magic comments to facilitate graph generation -- not a sustainable approach.) But a day spent hacking with Graphviz dramatically improved my learning rate, and it was also useful in helping describe the code to others.
I have done the same and it totally saved my ass on legacy code that I was tasked with extending or fixing.
I just pumped the output of dot to a static web page.
It was awesome.
Also, I rendered the entire graph as a single page, and started printing it tiled to multiple 8.5x11 sheets. One of the women I worked with that did all our document versioning and tracking saw me taping the sheets together, and asked me for a copy of the document. An hour later she walked into my office with a single page print from a 42" plotter. That hung like artwork on my office wall for about eight years.
She was a wonderful soul for that. And the print was beautiful.
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.
Continuing to show my ignorance, would adding a TikZ output option be a good thing? I'm fuzzy as to Tex/LaTex/TikZ relationship. The graphics part in TikZ looks pretty simple to do. The font/equations/... stuff is an unknown story.
at some point I was able to do this via tex->dvi->postscript->pdf conversion - basically getting the font installed in ghostscript let me use it directly from graphviz when rendering to eps and installing the font into the tex/postscript machinery let me also reference the same font.
granted, this was not fun, and also now 'modern' tex (not sure about graphviz) will use fontconfig on linux which may require different machinations.
so obviously your point on 'better integration' still stands unless I'm just out of date on how to do it..
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.
I'm excited for better default styles and colors. I love the text editing experience of Graphviz but spend a lot of time trying to style it unfortunately.
This is something I've not only thought out but have a design document surrounding.
What I want from graphviz is a rich library, based on D3, for building interactive web components for graphviz SVG output.
dot is an absolute dream for constructing automatic representations of graph and tree data, including great stuff like lexical scope and project maps. But simply building it into a raw SVG runs the risk of drowning in detail.
If this library were built in support of a graph generator SPA, something that lets a user tweak the huge state space of graphviz style parameters in real time, well, sky's the limit.
I work with parsers and abstract syntax trees professionally. I've been salivating over the kind of legibility we could introduce into this space with just such a library.
I know it's a huge undertaking! I think you'd find a lot of enthusiasm for actually doing it, if you organized the space to make it possible and put out a call to action.
I was thinking something similar. The default styles don't look super shiny, I suppose, but they are clean, which I appreciate. All in all, I think it does a good job of supporting my main reason for choosing graphviz over something like Visio: It encourages me to get the illustration done and then get on with my day without getting caught up with trying to make everything perfect.
I will turn to Visio if I need to make something presentation-quality, so there's that.
I have similar feelings about the lack of ability to fine-tune the layout: I've started seeing it as a feature, because it gives me a great feedback mechanism: If the graph is too complicated for Graphviz to lay out nicely, I take that as a sign that the thing the graph represents needs to be simplified. I've even gone so far as to incorporate Graphviz into my definition of done for a refactoring project: I kept a dotfile representing the current state of the dependency graph, and stopped refactoring when the rendered graph stopped making my eyes water.
"20 year old code"?!?
I have been using graphviz since early '90s, when ek provided a first prototype.
You mention a possible improvement of classes of nodes/edges. If I understood correctly, this is typically used for styling, and is most commonly achieved via a pre-processing step. We all use our own tools for that (I've personally used m4, cpp, sed, Tcl, and I'm sure others that I forget).
Graphviz is one of the tools that I use in a wide variety of circumstances. I'd say the most satisfying cases from all these years were (a) producing a genealogical graph of around 1000 people drawn with neato (very organic-looking!); and (b) producing orgcharts for an organization (that had to look acceptable to what people were used to seeing).
Right now my biggest gripe is I can't tell clusters to go to a specific rank. Although enabling "newrank" helped a lot, clusters I want to be the first, or last of the whole graph, still end in the middle for whatever reason, resulting in lots of edges that curve backwards, so the graph overall shape instead of looking like a diamond or a wrapped candy, instead looks like a big mess with lots of U shaped edges that go all over each other resulting in something completely impossible to read.
EDIT: also, being able to create "venn diagrams" of sorts with subgraphs would be awesome, basically allowing a node to be in several clusters, and have the clusters borders cross each other so that the item is inside all of them.
> - 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 "modern trends", instead we need to go back to the drawing board and find out what the problem is first.
Can you identify the problem with the design besides the superficial aesthetic (which can be easily themed)?
> Design is not something that should be tied to a particular decade.
Design does not exist in a vacuum. Technological progress, for example, creates the need for design change. Microsoft's switch from a serif to a sans serif font as the default typeface for Word was a good move, because we rarely print documents anymore and a the best design for print is not the same as the best design for screens.
20th century physics books had a distinct design for illustrations. It was beautiful and functional. But it was also designed around the limitations of their eventual monochrome (not even greyscale) print. A 2020 textbook does not have the same limitations and should not be designed with the same set of constraints.
> Design is how well a particular solution works for the purpose of it
That's one half. The other one is how people feel while using it. 1985 aesthetic makes people feel bad. Thus design is half bad. Or, for you maybe, half good.
:D The joy of aesthetics and style is that there's enough room for more than one of us to be right, and certainly enough room for all of us to be wrong :-)
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...)
> Fashion is a popular aesthetic expression at a particular time, place and in a specific context, especially in clothing, footwear, lifestyle, accessories, makeup, hairstyle, and body proportions.
Fashion is inexplicably linked to a particular time. Just like Art - Art evolves with time and it is part of the culture, current events, etc.
Design is not (unless you want to include say media as it changes through time. For e.g. print -> digital media).
I just want to say thank you for releasing this. I have been using graphviz since 2008. It is part of an internal tool to visualize information in the financial industry. It has been a life saver.
I've been looking into supporting UTF-8 characters to create graphs with non-English text using Graphviz in an application that's used on a number of different machines. Is there a straightforward way of doing this right now?
It would be nice if we could add a fonts folder in our application folder and set a relative path to it for Graphviz to perform its lookup in without having to rebuild Graphviz without fontconfig.
I took a closer look at the FAQ and it doesn't sound like Graphviz can do exactly what I'd like it to do.
"It is essential that a font which has the glyphs for your specified characters is available at final rendering time."
It sounds to me like UTF-8 encoded characters won't show if the font isn't available on the machine, in which case we'd have to either somehow force a font install or ideally just package the font with the application. The latter would require rebuilding Graphviz without fontconfig enabled, I think?
Just an appreciation post, not a question. I have reached out to graphviz as my tool of choice for diagramming for my entire career. Sometimes years go by without me using it, but I always end of finding a place to use it.
Recently I started teaching Software Development, and once again reached for graphviz for a huge variety of classroom uses.
> - more expressive graph language with classes or templates
There are some who view the dot language as an "assembler" language, good as the output for graph generators. It would be desirable to have more expressive costructs, but barring that, a lot can be achieved by using gvpr, m4 or various scripting languages.
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 most?
- better default styles that don't look like troff from 1985
- better default layout parameters in neato than statistical multidimensional scaling based on shortest path
- more expressive graph language with classes or templates
- more robust handling of error conditions like out of memory
- better documentation to help people find useful tools or just know what they should be looking for
- 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
Hope this makes sense.