The GraphViz DOT is a super-simple language that makes it very easy to create graphs and export them to various graphical formats. However, there are situations where you want to generate an ASCII graph. For example, to embed a flowchart or digraph in source code or documentation. GraphViz provides no exporter that can output an ASCII graph.
Thankfully, I found that this can be achieved using a Perl module called Graph::Easy. It can use GraphViz to understand your DOT file and then convert that to an elegant ASCII graph.
Here is how to use that:
- We need to install the Graph::Easy module from CPAN. Make sure you have CPANMinus already installed, as described here. We install the Graph module like this:
$ sudo cpanm Graph::Easy
- The Graph::Easy module installs a graph-easy program which we use to convert DOT graph to ASCII:
$ graph-easy life.dot
Tried with: Perl 5.22 and CPAN 1.61