Graphviz Tips
Last-Modified:<2008-03-20 11:21:23>
基本
dot の使用例
% dot -Tpng -o test.png test.dot
png形式の画像ファイルtest.pngをから作成
二部グラフの描画
以下のようにすると2部グラフっぽく描画される。
digraph sample {
graph [ranksep = 2.0 ,rankdir = LR];
node [shape = circle];
0 -> 7
0 -> 8
0 -> 9
1 -> 9
1 -> 10
1 -> 12
2 -> 10
2 -> 11
3 -> 10
3 -> 11
3 -> 13
4 -> 12
4 -> 13
5 -> 13
6 -> 13
{rank = same ;0;1;2;3;4;5;6}
{rank = same ;7;8;9;10;11;12;13}
}
複数のdotファイルを処理する
以下のようなシェルスクリプトを作成し実行
#!/bin/sh
find . -type f -name '*.dot' | while read file ; do
echo $file to ${file%dot}png
dot -Tpng -o ${file%dot}png $file
done