예제 #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 TestThoughtWorksRailNetwork10()
        {
            // The number of different routes from C to C with a distance of less than 30.
            // In the sample data, the trips are: CDC, CEBC, CEBCDC, CDCEBC, CDEBC, CEBCEBC, CEBCEBCEBC.
            PathGenerators pathGenerator = new PathGenerators(this.Graph);
            var            paths         = pathGenerator.GeneratePathsWithinRangeOfCost("C", "C", 1, 30);

            Console.WriteLine(paths?.Count.ToString() ?? "NO SUCH ROUTE");
        }
예제 #4
0
        public void TestCreatingBidirectionalGraph()
        {
            var tr = GraphReaderFactory.Create("ThoughtWorks", "sample", Directionality.Bidirectional);

            this.Graph = tr.Graph;
            Assert.IsNotNull(Graph);

            // ReSharper disable once UnusedVariable
            PathGenerators pathGenerator = new PathGenerators(this.Graph);
        }
예제 #5
0
        public void TestThoughtWorksRailNetwork10()
        {
            // The number of different routes from C to C with a distance of less than 30.
            // In the sample data, the trips are: CDC, CEBC, CEBCDC, CDCEBC, CDEBC, CEBCEBC, CEBCEBCEBC.
            PathGenerators pathGenerator = new PathGenerators(this.Graph);
            var            paths         = pathGenerator.GeneratePathsWithinRangeOfCost("C", "C", 1, 30);

            Assert.IsNotNull(paths, "There should be paths");
            Assert.IsTrue(paths.Count == 7, "The number of paths from C to C with a distance of under 30 should be 7");
        }
예제 #6
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");
        }
예제 #7
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");
        }