Exemplo n.º 1
0
        private static void Test2()
        {
            Graph g = new Graph(3,
                                new Edge(0, 2),
                                new Edge(0, 1),
                                new Edge(1, 2));

            ThreeColoringCNFSentence cnf  = new ThreeColoringCNFSentence(g);
            KColoringCNFSentence     cnfK = new KColoringCNFSentence(g, 3);

            Console.WriteLine(cnf.ToDIMACS());
            Console.WriteLine();
            Console.WriteLine(cnfK.ToDIMACS());

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Graph graph3b = new Graph(7,
                                      Edge.FromChars('a', 'b'),
                                      Edge.FromChars('a', 'c'),
                                      Edge.FromChars('a', 'g'),
                                      Edge.FromChars('b', 'c'),
                                      Edge.FromChars('b', 'd'),
                                      Edge.FromChars('c', 'd'),
                                      Edge.FromChars('d', 'e'),
                                      Edge.FromChars('d', 'f'),
                                      Edge.FromChars('e', 'f'),
                                      Edge.FromChars('e', 'g'),
                                      Edge.FromChars('f', 'g'));

            Graph graph3c = new Graph(7,
                                      Edge.FromChars('a', 'b'),
                                      // Edge.FromChars('a', 'c'),
                                      Edge.FromChars('a', 'g'),
                                      Edge.FromChars('b', 'c'),
                                      Edge.FromChars('b', 'd'),
                                      Edge.FromChars('c', 'd'),
                                      Edge.FromChars('d', 'e'),
                                      Edge.FromChars('d', 'f'),
                                      Edge.FromChars('e', 'f'),
                                      Edge.FromChars('e', 'g'),
                                      Edge.FromChars('f', 'g'));

            ThreeColoringCNFSentence sentence3b  = new ThreeColoringCNFSentence(graph3b);
            KColoringCNFSentence     sentence3bK = new KColoringCNFSentence(graph3b, 3);

            ThreeColoringCNFSentence sentence3c = new ThreeColoringCNFSentence(graph3c);

            SaveCNF("week1_3b", sentence3b.ToDIMACS());
            SaveCNF("week1_3c", sentence3c.ToDIMACS());

            Console.WriteLine(sentence3b.ToDIMACS());
            Console.WriteLine();
            Console.WriteLine(sentence3bK.ToDIMACS());

            Console.ReadLine();
        }