Ejemplo n.º 1
0
        public void TestHamilton()
        {
            var projectPath = Directory
                              .GetParent(Environment.CurrentDirectory)
                              .Parent
                              .FullName;

            var HamiltonTrueDirectory  = Path.Combine(projectPath, "Graphs", "Hamilton", "True");
            var HamiltonFalseDirectory = Path.Combine(projectPath, "Graphs", "Hamilton", "False");

            var TrueGraphs  = Directory.GetFiles(HamiltonTrueDirectory);
            var FalseGraphs = Directory.GetFiles(HamiltonFalseDirectory);

            foreach (var graph in TrueGraphs)
            {
                var Graph = GraphLoad.LoadMatrix(graph);
                Assert.IsTrue(Hamilton.IsHamilton(Graph), graph);
            }

            foreach (var graph in FalseGraphs)
            {
                var Graph = GraphLoad.LoadMatrix(graph);
                Assert.IsFalse(Hamilton.IsHamilton(Graph), graph);
            }
        }
Ejemplo n.º 2
0
        private void IsHamilton(object sender, RoutedEventArgs e)
        {
            bool value = Hamilton.IsHamilton(Graph);

            string message = "Graf " + (value ? "" : "nie") + " jest Hamiltonowski";

            MessageBox.Show(message);
        }