1.安装graphviz
sudo apt-get install graphviz
2.编写.dot文件
vi test.dot
digraph abc{
a;
b;
c;
d;
e;
a->b [label=left]
a->e [label=abc]
b->d
e->d
}
3.编译生成图片
dot -Tpng test.dot -o test.png
eog test.png
4.改进后代码,可以设置节点颜色
digraph abc{
a [color=red style=filled fontcolor=white];
b [color=black style=filled fontcolor=white];
c [color=black];
d;
e;
a->b [label=left]
a->e [label=abc]
b->d
e->d
}