大学のレポートで状態遷移図を描く必要があったので、
使ってるノートPC(Ubuntu)に Graphviz というものを入れてみました。
まずは Ubuntu にあるのかねということで(インストール後だからちょっと表示が違うかも)
$ aptitude search graphviz yutaro@X40:~/Documents/aiouyou$ aptitude search graphviz i graphviz - rich set of graph drawing tools i graphviz-cairo - Cairo rendering plugin for graphviz p graphviz-dev - transitional package for graphviz-dev rena i graphviz-doc - additional documentation for graphviz
インストールはもちろん aptitude で。
なんとなく doc と cairo plugin も入れてみた。
sudo aptitude install graphviz graphviz-cairo graphviz-doc
hogehoge.dotというファイルにはこんな感じで書きます。
digraph mizugame_states {
one [label = "InitialState 5[0],7[0]]"]
two [label = "5[5],7[0]"]
three [label = "5[0],7[7]"]
four [label = "5[5],7[7]"]
five [label = "5[0],7[5]"]
six [label = "5[5],7[2]"]
seven [label = "5[5],7[7]"]
eight [label = "5[5],7[5]"]
nine [label = "5[0],7[2]"]
ten [label = "5[3],7[7]"]
eleven [label = "5[2],7[0]"]
twelve [label = "5[2],7[7]"]
thirt [label = "5[5],7[4]"]
fourt [label = "TargetState 5[0],7[4]"]
one -> two;
one -> three;
two -> four;
two -> five;
three -> six;
three -> seven;
five -> eight;
six -> nine;
eight -> ten;
nine -> eleven;
eleven -> twelve;
twelve -> thirt;
thirt -> fourt;
}使ったソースのまんまで掲載w
dot コマンドを使って Teps を呼び出して eps 形式に変換(Tepsってあるのかわからないけどこれでうまくいった
dot -Teps hogehoge.dot -o hogehoge.eps
あ、明日は LOCAL DEVELOPER DAY '10 /Winter
というイベントがありますよ!
僕もLTで参加しまーす。
お時間があれば参加していただけるとうれしいなぁ。
