Perlのモジュールをつかいつつ、AAで簡単にグラフを書く

CPANでGraph::Easyをinstall

$ cpanm Graph::Easy
--> Working on Graph::Easy
Fetching
http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/Graph-Easy-0.71.tar.gz ...
OK
Configuring Graph-Easy-0.71 ... OK
Building and testing Graph-Easy-0.71 ... OK
Successfully installed Graph-Easy-0.71
1 distribution installed

直接出力(集約)

$ graph-easy <<<'[R1],[R2] --> [R3]-->[R4]'
+----+     +----+     +----+
| R1 | --> | R3 | --> | R4 |
+----+     +----+     +----+
             ^
             |
             |
           +----+
           | R2 |
           +----+

直接出力(拡散)

$ graph-easy <<<'[R1]-->[R2],[R3],[R4]'
+----+     +----+     +----+
| R4 | <-- | R1 | --> | R3 |
+----+     +----+     +----+
             |
             |
             v
           +----+
           | R2 |
           +----+

外部ファイルを読み込んで出力

$ cat topology.txt
[R1] -- lan1 --> [R2]
[R1] -- lan2 --> [R3]
[R3] --> [R4]
[R2] --> [R4]

$ graph-easy topology.txt
+-------+  lan2   +----+     +----+
|  R1   | ------> | R3 | --> | R4 |
+-------+         +----+     +----+
  |                            ^
  | lan1                       |
  v                            |
+-------+                      |
|  R2   | ---------------------+
+-------+

Graph::Easy - Manual - Syntax
Graph::Easy::Parser - Parse Graph::Easy from textual description - metacpan.org