Graphviz入れてみました
いろいろ便利そうだったので、こちらを参考にインストールして、min-max探索木を書いてみました。
ソース(tree.dot)はこんな感じ。
digraph { // 下から上へグラフを伸ばし、グラフサイズは8x8インチ graph[ rankdir = BT, size = "8, 8" ]; // 各ノードのラベルと形の指定 R[ label = "R / 1", shape = circle ]; E1[ label = "E1 / 1", shape = doublecircle ]; E2[ label = "E2 / -4", shape = doublecircle ]; E3[ label = "E3 / -3", shape = doublecircle ]; S11[ label = "S11 / 3", shape = circle ]; S12[ label = "S12 / 5", shape = circle ]; S13[ label = "S13 / 1", shape = circle ]; S21[ label = "S21 / 7", shape = circle ]; S22[ label = "S22 / 3", shape = circle ]; S23[ label = "S23 / -4", shape = circle ]; S31[ label = "S31 / -3", shape = circle ]; S32[ label = "S32 / 0", shape = circle ]; S33[ label = "S33 / 3", shape = circle ]; // ノード間の接続 R -> E1 [style = bold, color = red ]; E1 -> S11; E1 -> S12; E1 -> S13 [style = bold, color = red ]; R -> E2; E2 -> S21; E2 -> S22; E2 -> S23 [style = bold, color = red ]; R -> E3; E3 -> S31 [style = bold, color = red ]; E3 -> S32; E3 -> S33; }
で、これをコンパイルするとこうなります。
ここまで全行程で所要時間30分ほど。スッゲー便利です。