Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to convert DOT graph to ASCII

📅 2017-Oct-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

  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:

[code lang="text"] $ sudo cpanm Graph::Easy




  * The Graph::Easy module installs a **graph-easy** program which we use to convert DOT graph to ASCII:






[code lang="text"]
$ graph-easy life.dot

Tried with: Perl 5.22 and CPAN 1.61