示例#1
0
        static void Main(string[] args)
        {
            string[]      graphFileLines = System.IO.File.ReadAllLines(@"C:\Users\Josip\Documents\FAKS\NASP\LAB3\graph3.txt");
            WeightedGraph graph          = new WeightedGraph(graphFileLines);

            ShortestPathCalculator.CalcShortestPath(graph);
        }
        public void ComputeShortestPath()
        {
            ShortestPathCalculator calc = new ShortestPathCalculator();

            int shortestPath = calc.ComputeShortestPath(1, 7, fileName);

            Assert.IsTrue(shortestPath == 2599);

            shortestPath = calc.ComputeShortestPath(1, 37, fileName);

            Assert.IsTrue(shortestPath == 2610);

            shortestPath = calc.ComputeShortestPath(1, 59, fileName);

            Assert.IsTrue(shortestPath == 2947);

            shortestPath = calc.ComputeShortestPath(1, 82, fileName);

            Assert.IsTrue(shortestPath > 0);

            shortestPath = calc.ComputeShortestPath(1, 99, fileName);

            Assert.IsTrue(shortestPath > 0);

            shortestPath = calc.ComputeShortestPath(1, 115, fileName);

            Assert.IsTrue(shortestPath > 0);

            shortestPath = calc.ComputeShortestPath(1, 133, fileName);

            Assert.IsTrue(shortestPath > 0);

            shortestPath = calc.ComputeShortestPath(1, 165, fileName);

            Assert.IsTrue(shortestPath > 0);

            shortestPath = calc.ComputeShortestPath(1, 188, fileName);

            Assert.IsTrue(shortestPath > 0);

            shortestPath = calc.ComputeShortestPath(1, 197, fileName);

            Assert.IsTrue(shortestPath > 0);
        }