static void Main(string[] args) { const string path = @"D:\Projects\Algorithms\ShortestPath\dijkstraData.txt"; //const string path = @"D:\Projects\Algorithms\ShortestPath\temp.txt"; Stopwatch sw = new Stopwatch(); sw.Start(); var graph = new Graph(path); var loadTime = sw.Elapsed; sw.Restart(); //var route = new Route(); //Vertex currentNode = graph.Vertices[0]; //route.Add(currentNode); //for (int i = 0; i < 5; i++) //{ // route.Add(currentNode.AdjacentEdges[0].Tail); // currentNode = currentNode.AdjacentEdges[0].Tail; //} foreach (var i in new[] { 7, 37, 59, 82, 99, 115, 133, 165, 188, 197 }) { var cost = graph.GetShortestPath(1, i).Cost; } sw.Stop(); var workTime = sw.Elapsed; Console.WriteLine("Load time: {0}ms, work time: {1}ms, total: {2}ms", loadTime.Milliseconds, workTime.Milliseconds, (loadTime+workTime).Milliseconds); //result.Clear(); //foreach (var i in new[] { 7, 37, 59, 82, 99, 115, 133, 165, 188, 197 }) //{ // result.Add(graph.GetShortestPath(i, 1).Cost); // //Console.WriteLine("from 1 to {0} {1}", i, ); //} //Console.WriteLine(String.Join(",", result)); //for (int i = 2; i < 31; i++) //{ // var route = graph.GetShortestPath(1, i); // result.Add(route == null ? 1000000 : route.Cost); //} //Console.WriteLine(String.Join(",", result)); //result.Clear(); //for (int i = 2; i < 31; i++) //{ // var route = graph.GetShortestPath(i, 1); // result.Add(route == null ? 1000000 : route.Cost); //} //Console.WriteLine(String.Join(",", result)); }