
A Quick Introduction to Graphviz - jworthe
https://www.worthe-it.co.za/programming/2017/09/19/quick-introduction-to-graphviz.html
======
MurrayHill1980
Thank you all for the comments and suggestions. Most of the criticisms are
quite fair: graph language improvements, modernization including default
styles that aren't from 1980, bring Javascript interfaces like viz.js into the
code base, coding multithreaded solvers, etc. Emden Gansner and I left AT&T a
few years ago (in my case, it was AT&T's idea not mine) and we have not put a
lot of work into the code lately. Emden's done a lot to move the website to
gitlab.com that is about ready to go (instead of hosting the site in a VM on a
1.1Ghz Pentium or whatever we left in the rednet closet in AT&T.) We have a
small backlog of algorithmic improvements. For instance, Emden implemented
Ulrik Brandes' "untangling hairballs" algorithm but it's not in the code base.
I realize this is a standard open source refrain, but "if anyone knows how we
could support ourselves by working on this, let us know."

Some of the main lessons from this software, which can be applied by other
projects:

\- For certain applications, people need rich types of diagrams, not just dots
and lines. Many automatic tools including ours often still do not reach the
quality of the best handmade diagrams.

\- We can benefit from using more general systems of constraints, and this
area of research deserves further study and exploration.

\- Interaction, complex APIs, embedding your software in bigger, more
elaborate systems is great, but presents some users with a lot of complication
that is too costly to surmount.

\- Documenting your work in a way that makes it accessible is as important as
the work itself. We did fall short there.

We're grateful we had a good run with graphviz.

Best regards, Stephen North north from graphviz.org

~~~
fao_
You might like to look into Patreon as an income model -- you can set it up to
get payed each time you release a new feature, or periodically, and people
pledge money towards you.

------
orless
For everyone interested in algorithms behind Graphviz, here's a paper so start
with:

[http://www.graphviz.org/Documentation/TSE93.pdf](http://www.graphviz.org/Documentation/TSE93.pdf)

This work is absolutely amazing. I've tried implementing it a few years ago
(as an excervise when preparing for Google interview). So naive. I've found
out that I have read each and every sentence extremely carefully to get things
right. I got quite far but never finished the implementation. (And I did not
get an offer from Google either.)

~~~
mikhailfranco
The clue is in the name - 1993. It is just a pile of incompatible heuristics.
I have used it, but I feel its inadequacies like a stiletto to the heart. Draw
a quadrilateral with NEATO and see how many times you get a hideous bow tie.
Pathetic. Its penumbral effect has been to stifle any real progress in better
rival open source libraries, and hence we are all so much more impoverished
today.

~~~
rout39574
I'm a little taken aback at your vitriol. Is "Stifled other libraries" a
synonym for "Does the job well enough that nothing else was able to compete" ?
That's been my sense. A lingua franca for graph visualization, pervasively
available.

I hardly think they'd turn away algorithmic contributions, if you've got some.

Do you have an example of your hideous bow ties? I don't usually use graphviz
to 'draw' anything, so I don't really have the context to understand your
complaint. I've never seen a result I think of as a hideous bow tie.

~~~
mikhailfranco
[http://www.graphviz.org/pdf/neatoguide.pdf](http://www.graphviz.org/pdf/neatoguide.pdf)

Page 6 Figure 5.

------
RubenSandwich
Graphviz is such an amazing DSL. I thought myself it in college and do all of
my architecture drawings in it. (I even outlined a chat bots conversation flow
with it.) I'm surprised by how many developers don't know about it/use it. It
might be because of it's late 90's website,
[http://www.graphviz.org/](http://www.graphviz.org/), which is a shame.

~~~
kasbah
I love Graphviz and use it a lot but can't help but think every time: there
must be a better way to describe directed graphs. Does anyone know of any
alternative DSLs that try to solve the same problem in a radically different
way?

~~~
enriquto
What probblems do you see, for example, in the graphviz language ?

It seems to me that the syntax is rather simple and minimal.

~~~
Someone
I’m not the OP, but of the top of my head, I would like to have:

    
    
      - scoping for node and edge styles (among other things, this would help
        towards copy-pasting graphs into subgraphs)
      - named styles (e.g. define *”shape=foo”* as red rectangles with italic
        text)
      - more consistency in graph attributes across layout engines
      - more intuitive effect of graph attributes on layout
      - easier way to style node content (the ‘old’ way was ugly, but the
        restricted subset of html isn’t that nice, either)
      - ability to switch layout engines in subgraphs (among other things,
        this would help towards copy-pasting graphs into subgraphs)
    

Also (from the article) _”If your rankdir is vertical, then you need to use {}
to change the record type’s direction.”_ , IMO, is not what most users would
expect, and is a pain in the ass when experimenting to find an optimal layout
engine/graph attributes pair.

------
bleair
Graphviz is fantastic. I'm pretty sure you can still read your .dot files into
OmniGraffle (for when you need to add a lot of color and annotations). I also
think its power comes from being to be turned into a callable library useful
in several other languages (python). Also I can't imagine using a service that
hosts my private data in order to build a layout... but maybe that's just me.

Two other alternatives: The best one for network-bounce / sequence diagrams..
great for when you need to explain all the bounces in your mulit-tiered web
app
[https://www.websequencediagrams.com/](https://www.websequencediagrams.com/)
and
[http://sverweij.github.io/mscgen_js/](http://sverweij.github.io/mscgen_js/)

~~~
donatj
I believe you need the pro version of OmniGraffle to open them.

~~~
riffraff
I don't think so, the sites seem to indicate free can also open dot files[0],
I do believe there is a limit on the number of elements though.

IIRC I did some graphs for my bachelor thesis (10+ years ago) with graphviz,
and then basically just passed them through OmniGraffle to make them
beautiful.

[0] [https://support.omnigroup.com/doc-assets//OmniGraffle-
Mac/Om...](https://support.omnigroup.com/doc-assets//OmniGraffle-
Mac/OmniGraffle-Mac-v7.0.0.1/en/EPUB/xhtml/0301_import.xhtml)

------
xroche
Probably the only VCS-friendly format for graphs. If you want to write
technical design documentation, you have to put it along with sources (because
this is the natural lifecycle environment of sources - fixed word-processing-
like documents or confluence will never be able to handle well versions,
branches, backports), and for this reason, a diff-friendly text format is
mandatory.

Using Graphviz is the only way I know to build such specs. Bonus point: many
online VCS renderer are able to display .md format, with embedded .svg images
(directly produced from Graphviz).

------
hmottestad
I've been developing a radix tree on the side and one of the hardest things
was to visualize the tree when debugging. Adding some code to print it as DOT
was super simple and made it easy to copy paste into an online graphiz
visualizer to inspect the tree.

------
donatj
I discovered Graphviz a few years ago and am a huge fan. I’ve built many
visualizations with it, it’s amazingly simple to use yet amazingly powerful. I
really wish I had found it ten years earlier.

------
midnitewarrior
I've used this tool a bit, it's the good kind of voodoo, but it desperately
needs modernization, it looks like it was forged in the '90s and was never
updated.

~~~
donatj
What would you change? To me it feels nearly perfect and feature complete.

~~~
Zhyl
At the moment most popular interpreters will generate graphs that look... old.
It might be the serif font, it might be the slightly clunky label placement.
It could even be the black outline, no fill of the default.

Of course, you can change the defaults, but creating the 'look' you want
textually without an interactive creator is non-trivial. Given that the main
strength of graphviz is that I can write it in a stream of consciousness (like
markdown), or generate it automatically using some kind of script from another
data source, this is somewhat of a blocker in its usefulness.

And, of course, the customisation syntax is fairly clunky and not easily
readable. I don't think I've seen a DSL that does colouring _well_ in this
regard, but graphviz goes a step further by not being consistent with CSS or
other markups.

It is good in terms of feature-completeness, but as mentioned in the TC, there
are areas where it could be polished up a bit to make it feel more modern.

~~~
bitexploder
I agree styling isn't exactly easy, but I have built very nice mplex diagrams
I'm a fraction of the time I could have done it in a tool like Visio. Compared
to endlessly thrashing about in a GUI it is still a dream. I think because it
is just polish no one has really had the desire to do a significant update.

~~~
achamayou
There are a bunch of prettifiers for the SVG output, I couldn't find the one I
used last time, but stumbled across this one that seems very neat and even
makes the graph interactive:
[https://github.com/mountainstorm/jquery.graphviz.svg/](https://github.com/mountainstorm/jquery.graphviz.svg/)

Edit: found it [https://github.com/vidarh/diagram-
tools/tree/master](https://github.com/vidarh/diagram-tools/tree/master)

------
language
Love Graphviz, been using it for some time now. It's kind of painful rendering
large graphs. Does anyone know the particular reason why `dot` and friends
only seem to take advantage of one CPU core when drawing graphs? Multi-
threading unimplemented? - or impossible to implement for some reason?

~~~
stuaxo
Sounds about right, 'dot' is about as old as the hills, so it probably wasn't
an issue back in the day.

------
reconbot
Does anyone have any favorite tools for visualizing very large graphs?

I'm thinking 200k nodes and 2 million edges? Graphviz segfaults graphs a
fraction of the size and even at that scale a node by node representation
isn't super helpful without being able to zoom out and look for patterns.

~~~
jamessb
What layout algorithm are you using for graphviz? sfdp is less computationally
intensive than dot/neato/circo, and I would have thought it would be able to
cope (assuming you have enough RAM/swap) - this gallery [1] uses graphviz to
visualize networks from the University of Florida Sparse Matrix collection,
the largest of which "have tens of millions of nodes and over a billion of
edges".

Gephi and Cytoscape are the main free graphical applications for analyzing
networks; they might work for you. Tulip [2] might also be worth a try.

[1]:
[https://web.archive.org/web/20111102185002/http://www2.resea...](https://web.archive.org/web/20111102185002/http://www2.research.att.com:80/~yifanhu/GALLERY/GRAPHS/indexAll.html)

[2]: [http://tulip.labri.fr/TulipDrupal/](http://tulip.labri.fr/TulipDrupal/)

------
wjossey
For my senior thesis in undergrad (2008), I used graphviz as part of my
tooling for visualizing graph algorithms. I held onto that code and it still
chills in GitHub (although I wouldn’t be intro’d to github till grad school a
year later).

[https://github.com/wjossey/skidmore-
vega](https://github.com/wjossey/skidmore-vega)

Sometimes it’s painful to go back and see the code you wrote that long ago,
but what’s great is to see frameworks like this still chugging along providing
value for over a decade.

------
nevi-me
Great intro! I love graphviz, it's saved me tons of time. My former colleague
wrote a "code parser" that went through SAS and SQL code, creating dependency
trees of the data/tables and procedures/functions used. She wrote it in SAS,
which alone is crazy. Her code would output .dot files, and then she'd create
PNGs out of them.

When we needed high res images, we exported to SVG, and I was able to import
those into Visio. She saved me days or weeks of documenting.

------
kevinpet
I use graphviz quite a bit for doing diagrams of data flow or UI flows. It's
easy to get something sufficient to communicate, but in my experience very
hard to get something you'd be happy putting in a presentation that's going to
be seen outside engineering.

------
atsaloli
I want to put the plug in for nwdiag which is like graphviz for network
diagrams: [http://blockdiag.com/en/nwdiag/nwdiag-
examples.html](http://blockdiag.com/en/nwdiag/nwdiag-examples.html)

Saves heaps of time over fiddling with Visio.

------
throwaway7645
Use it all the time to describe entwined processes and for engineering when
you have lots of different equipment connected in of ways & need to describe
it.

