Ejemplo n.º 1
0
        public void FindPathBetween0And1()
        {
            var path   = MyDijkstra.DijkstraAlgorithm(Graph, 0, 1);
            var length = 0;

            for (int i = 1; i < path.Count; i++)
            {
                length += Graph[path[i - 1], path[i]];
            }

            var expectedPath   = new[] { 0, 8, 5, 4, 11, 1 };
            var expectedLength = 37;

            Assert.AreEqual(expectedLength, length);
            CollectionAssert.AreEqual(path, expectedPath);
        }
Ejemplo n.º 2
0
        public void FindPathBetween0And10()
        {
            var path = MyDijkstra.DijkstraAlgorithm(Graph, 0, 10);

            Assert.IsNull(path);
        }