Esempio n. 1
0
        public void Test_Algorithm_Simple3VertexGraph()
        {
            Graph <Vector2>       graph  = GraphHelper.CreateGraph_3Vertex_Simple();
            AStarRunner <Vector2> runner = new AStarRunner <Vector2>(graph);

            Vertex <Vector2>[] result = runner.Run(graph.GetVertex(1), graph.GetVertex(3), Heuristics.Manhattan)
                                        .ToArray();

            Vertex <Vector2> vertex1 = graph.GetVertex(1);
            Vertex <Vector2> vertex2 = graph.GetVertex(2);

            Assert.AreEqual(vertex1, result[0]);
            Assert.AreEqual(vertex2, result[1]);
        }
Esempio n. 2
0
        public void Test_Algorithm_Simple3VertexGraph()
        {
            Graph <Vector2>          graph  = GraphHelper.CreateGraph_3Vertex_Simple();
            DijkstraRunner <Vector2> runner = new DijkstraRunner <Vector2>(graph);

            (Vertex <Vector2> dest, double cost)[] result = runner.Run(graph.GetVertex(1))