Beispiel #1
0
 private void WriteFileGRAPHVIZ(TableuxNode baseNode)
 {
     try {
         var temp = GenerateGraphVIZTEXT(baseNode);
         File.WriteAllText("abc.dot", GenerateGraphVIZTEXT(baseNode));
     } catch (Exception e) {
         MessageBox.Show(e.Message);
     }
 }
Beispiel #2
0
 public void GetGraphImage(PictureBox pictureBox, TableuxNode baseNode)
 {
     WriteFileGRAPHVIZ(baseNode);
     System.Diagnostics.Process dot = new System.Diagnostics.Process();
     dot.StartInfo.FileName  = "dot.exe";
     dot.StartInfo.Arguments = "-Tpng -oabc.png abc.dot";
     dot.Start();
     dot.WaitForExit();
     pictureBox.ImageLocation = "abc.png";
 }
Beispiel #3
0
        private void PrintNodeConnections(TableuxNode root)
        {
            if (root == null)
            {
                return;
            }

            nodeConnections += root.PrintConnections();

            PrintNodeConnections(root.Left);
            PrintNodeConnections(root.Right);
        }
Beispiel #4
0
        public void TautologyCheckInListOfTableuxNode()
        {
            PropositionNode propNode = new PropositionNode('R'.ToString());

            NotNode notNode = new NotNode();

            notNode.left = Functions.DeepCopyTree(propNode);

            PropositionNode p2 = new PropositionNode('Q'.ToString());

            List <Node> list = new List <Node> {
                propNode, notNode, p2
            };

            Assert.True(TableuxNode.IsTautology(list));
        }
Beispiel #5
0
        private void PreOrderTraverse(TableuxNode node)
        {
            if (node == null)
            {
                return;
            }

            counterForInorderTraversal++;
            /* first print data of node */

            transitional_output += "node" + node.id + " [ label = \"" + node + "\" ]\n";

            /* then recur on left subtree */
            PreOrderTraverse(node.Left);

            /* now recur on right subtree */
            PreOrderTraverse(node.Right);
        }
Beispiel #6
0
        private string GenerateGraphVIZTEXT(TableuxNode baseNode)
        {
            // -------------------------------------------------------------------
            // resetting all variables
            output = "graph logics {\nnode [ fontname = \"Arial\" ]\n";
            transitional_output        = string.Empty;
            nodeConnections            = string.Empty;
            counterForInorderTraversal = 0;
            PreOrderTraverse(baseNode);
            // -------------------------------------------------------------------

            PrintNodeConnections(baseNode);
            output += transitional_output;
            output += nodeConnections;

            output += "}";

            return(output);
        }
Beispiel #7
0
        public void GenerateGraphImage(PictureBox pictureBox, TableuxNode node)
        {
            Graphiz graphiz = new Graphiz();

            graphiz.GetGraphImage(pictureBox, node);
        }