private void BuildGraph() { graph.Edges.Clear(); graph.NodeMap.Clear(); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); RobddGraph robddGraph1 = null; realNames = new Dictionary <int, String>(); edge_weight = new Dictionary <int, int>(); BooleanExpression expr = new BooleanExpression(expression); try { robddGraph1 = new RobddGraph(); robddGraph1.Build(expr); Console.WriteLine("ALL SAT"); Console.WriteLine(expr.GetVariableNames()); foreach (BitArray array in robddGraph1.AllSat()) { Console.WriteLine( ConvertBitSetToString(array, expr.GetVariablesCount())); } } catch (Exception e) { Console.WriteLine(e.StackTrace); } TDictionary tDict = robddGraph1.GettDict(); Dictionary <int, IndexLowHigh> dict = tDict.GettDict(); foreach (int node in dict.Keys) { if (node == 0 || node == 1) { //Добавить вершину graph.AddNode(node.ToString()).Attr.Shape = Microsoft.Glee.Drawing.Shape.Box; // GLEE realNames.Add(node, null); } else { IndexLowHigh ilh = dict[node]; int low = ilh.GetLow(); int high = ilh.GetHigh(); int index = ilh.GetIndex(); realNames.Add(node, expr.GetVariableName(index - 1)); int e = edgeFactory.Create(); edge_weight.Add(e, 0); //Добавить ребро graph.AddEdge(node.ToString(), low.ToString()).SourceNode.Attr.Shape = Microsoft.Glee.Drawing.Shape.Circle; e = edgeFactory.Create(); edge_weight.Add(e, 2); //Добавить ребро graph.AddEdge(node.ToString(), high.ToString()).SourceNode.Attr.Shape = Microsoft.Glee.Drawing.Shape.Circle; } } viewer.Graph = graph; //associate the viewer with the form form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); //show the form form.ShowDialog(); }