private void BuildTree( TreeNode parent, Graph g) { List<TreeNode> kids = new List<TreeNode>(); List<Node> Nodes = g.Preorder(); foreach (Node n in Nodes) { TreeNode t = new TreeNode(); t.Tag = n; parent.Nodes.Add(t); if (n.SubGraph != null) { t.Text = "loop"; BuildTree(t, n.SubGraph); } else { if (n.Block.LastInstruction is IBranchInstruction) { IBranchInstruction branch = n.Block.LastInstruction as IBranchInstruction; if (branch.Category == BranchCategory.BREAK_BRANCH) t.Text = "break"; else t.Text = "branch"; } else { t.Text = "node"; } } } }