예제 #1
0
        public void TestThoughtWorksRailNetwork7()
        {
            // The number of trips starting at A and ending at C with exactly 4 stops.
            // In the sample data below, there are three such trips: A to C (via B,C,D); A to C (via D,C,D); and A to C (via D,E,B).
            PathGenerators pathGenerator = new PathGenerators(this.Graph);
            var            paths         = pathGenerator.GeneratePathsWithinRangeOfStops("A", "C", 3, 4);

            Console.WriteLine(paths?.Count.ToString() ?? "NO SUCH ROUTE");
        }
예제 #2
0
        public void TestThoughtWorksRailNetwork6()
        {
            // The number of trips starting at C and ending at C with a maximum of 3 stops.
            // In the sample data below, there are two such trips: C-D-C (2 stops). and C-E-B-C (3 stops).
            PathGenerators pathGenerator = new PathGenerators(this.Graph);
            var            paths         = pathGenerator.GeneratePathsWithinRangeOfStops("C", "C", 1, 4);

            Console.WriteLine(paths?.Count.ToString() ?? "NO SUCH ROUTE");
        }
예제 #3
0
        public void TestThoughtWorksRailNetwork7()
        {
            // The number of trips starting at A and ending at C with exactly 4 stops.
            // In the sample data below, there are three such trips: A to C (via B,C,D); A to C (via D,C,D); and A to C (via D,E,B).
            PathGenerators pathGenerator = new PathGenerators(this.Graph);
            var            paths         = pathGenerator.GeneratePathsWithinRangeOfStops("A", "C", 3, 4);

            Assert.IsNotNull(paths, "There should be paths");
            Assert.IsTrue(paths.Count == 3, "The number of paths from A to C with exactly 4 stops should be 3");
        }
예제 #4
0
        public void TestThoughtWorksRailNetwork6()
        {
            // The number of trips starting at C and ending at C with a maximum of 3 stops.
            // In the sample data below, there are two such trips: C-D-C (2 stops). and C-E-B-C (3 stops).
            PathGenerators pathGenerator = new PathGenerators(this.Graph);
            var            paths         = pathGenerator.GeneratePathsWithinRangeOfStops("C", "C", 1, 4);

            Assert.IsNotNull(paths, "There should be paths");
            Assert.IsTrue(paths.Count == 2, "The number of paths from C to C of at most 3 stops should be 2");
        }