# Visualising Project Dependencies using GraphViz Diagrams

I’ve been working on defining a set of projects with my team which will provide a plan of how we can reach some business goals. There are dependencies between the projects, in that some of them have to be completed before others can start (sequential), while others can run alongside each other (parallel).

What I wanted to do was create a narrative of how we could get to business goals and what steps we’d need to pass along the way. I guess Project Managers might call these “Milestones”.

Drawing this kind of stuff out in a tool like Google Drawings or Visio can be a bit of pain, because as you think of new things, you have to adjust the diagram around which makes you stop thinking about what you’re doing while you drag a load of boxes around a screen so I’ve just started using http://graphviz.org to do this instead.

Although the syntax looks gnarly when you see a full-blown example with all the styling, it’s straightforward enough to use, and feels a bit like using https://www.websequencediagrams.com (which I use all the time).

There’s no need to have big chains of dependencies, you can just chain together a couple of items at a time, GraphViz can work out that A->B->C is equal to A->B;B->C; etc.

Here’s a minimal example of a dot file (“driving.gv”) where the goal is to buy a car.

The layout is created automatically by the tool, so adding new relationships between items can result in a completely different layout. You can also switch the orientation of the diagram from “top to bottom” (default) to “left to right” by setting the rankdir attribute to “LR”, which makes it look a bit like a timeline.

My workflow is to update the GraphView.gv text file and then run the command line (many text editors have tools within them that let you run external commands from within them). In another window, I have a preview of the output open, set to reload when changes happened.

The command line to produce “driving.png” from the input “driving.gv” file is below but there are many output options, such as postscript or TIFF.

"C:\Program Files (x86)\Graphviz2.38\bin\dot.exe" -Tpng -odriving.png driving.gv

The default styling is something you see a lot of in papers and books, but with a bit of colour selection and styling you can make something that fits better into a presentation.

I put this colour palette together using http://paletton.com/

One GraphViz feature I liked is that it’s possible to apply hyperlinks to the nodes (boxes on the diagrams) and get GraphViz to output clickable HTML imagemaps from the tool. I’ve used this feature on a wiki to link nodes on the overview to other pages which describe projects in more detail. There’s an example of how to get this running at http://www.graphviz.org/doc/info/output.html#d:cmapx

The documentation is a bit abstract until you read the guides, so I’d recommend having a quick read of http://www.graphviz.org/pdf/dotguide.pdf and get hacking on some examples.