Code Yarns β€πŸ‘¨β€πŸ’»
Tech Blog ❖ Personal Blog

How to convert DOT graph to ASCII

πŸ“… 2017-Oct-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ ascii, dot, graph, graphviz, perl ⬩ πŸ“š 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


Β© 2022 Ashwin Nanjappa β€’ All writing under CC BY-SA license β€’ 🐘 @codeyarns@hachyderm.io β€’ πŸ“§