Visualize Graphs

Learn how to render graphs using Graphviz.

We’ve got a couple of ways to render these DOT files. We can either use the Graphviz tools or else use a generic drawing package, such as OmniGraffle for the Mac or the GraphVizio plug-in for Visio on Windows. Here, we’ll look at rendering using Graphviz and OmniGraffle.

Render with Graphviz

Graphviz is an open-source graph visualization software developed by AT&T Labs that is distributed with a number of layout programs.

Graphviz ships with a number of tools for rendering DOT files. Typically these will be installed into /usr/local/bin, but you’ll need to check your own system for details of where they’re located.

Format module

We can call the appropriate Graphviz tool from Elixir by using the System.cmd/3 function. Let’s create a new module called Format and put that under NativeGraph, and we’ll add the function to_png/2:

Get hands-on with 1400+ tech skills courses.