Ejemplo n.º 1
0
        public void ShouldFindShortestPath3()
        {
            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(six, seven).ToArray();

            path[0].ShouldBe(six);
            path[1].ShouldBe(three);
            path[2].ShouldBe(four);
            path[3].ShouldBe(seven);
        }
Ejemplo n.º 2
0
        public void ShouldPathToNeighbour()
        {
            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(one, two).ToArray();

            path.Count().ShouldBe(2);

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
        }
Ejemplo n.º 3
0
        public void ShouldDetectNoPath()
        {
            var nine = new GraphNode<int>(9);
            _graph.AddNode(nine);

            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, nine).ToArray();

            path.Count().ShouldBe(0);
        }
Ejemplo n.º 4
0
        public void ShouldFindShortestPath1()
        {
            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(one, five).ToArray();

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
            path[2].ShouldBe(three);
            path[3].ShouldBe(six);
            path[4].ShouldBe(five);
        }
Ejemplo n.º 5
0
        public void ShouldDetectNoPath()
        {
            var nine = new GraphNode <int>(9);

            _graph.AddNode(nine);

            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(one, nine).ToArray();

            path.Count().ShouldBe(0);
        }
Ejemplo n.º 6
0
        public void ShouldFindShortestPath1()
        {
            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, five).ToArray();

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
            path[2].ShouldBe(three);
            path[3].ShouldBe(six);
            path[4].ShouldBe(five);
        }
Ejemplo n.º 7
0
        public void ShouldFindShortestPath2()
        {
            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, seven).ToArray();

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
            path[2].ShouldBe(four);
            path[3].ShouldBe(seven);
        }
Ejemplo n.º 8
0
        public void ShouldPathToNeighbour()
        {
            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, two).ToArray();

            path.Count().ShouldBe(2);

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
        }