コード例 #1
0
        // [Test, TestCaseSource(typeof(TestCaseFactory), "ClusterExplicitCases")]
        public void CanLoadGraphs(string inputFile, string outputFile)
        {
            (var info, var graph) = ExplicitClusterLoader.LoadData(inputFile);
            var count = File.ReadAllLines(inputFile).Count();

            Assert.AreEqual(count, graph.Count + 1);
        }
コード例 #2
0
        // [Test, TestCaseSource(typeof(TestCaseFactory), "ClusterExplicitCases")]
        public void CorrectSpacing(string inputFile, string outputFile)
        {
            (var info, var graph) = ExplicitClusterLoader.LoadData(inputFile);
            var spacing  = ExplicitClusterLoader.CalculateSpacing(info, graph);
            var expected = File.ReadLines(outputFile).WhereNotNull().Select(int.Parse).First();

            Assert.AreEqual(expected, spacing);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            (var count, var data) = ExplicitClusterLoader.LoadData("cluster1_data.txt");
            var spacing = ExplicitClusterLoader.CalculateSpacing(count, data);

            Console.WriteLine($"Explicit problem - max cluster spacing: {spacing}");

            (var info, var data2) = ImplicitClusterLoader.LoadData("cluster2_data.txt");
            var count2 = ImplicitClusterLoader.CountClusters(info, data2);

            Console.WriteLine($"Implicit problem - count needed for 3-spacing: {count2}");
        }