public static void ShowTree(Tree.RootNode root) { var scriptName = "tree.dot"; var fileName = "tree.png"; CreateTreeScript(root, scriptName); RunGraphviz(scriptName, fileName); Process.Start(fileName); }
static void CreateTreeScript(Tree.RootNode root, string fileName) { var str = new StringBuilder(); str.AppendFormat("digraph {0} {{ \n", Path.GetFileNameWithoutExtension(fileName)); foreach (var item in root.ToBreadthFirstList()) { str.AppendFormat("\t{0}_{1}[label=\"{0}\"];\n", item, item.Index); PrintTreeNode(item, str); } str.AppendLine("}"); File.WriteAllText(fileName, str.ToString()); }