Beispiel #1
0
        private static void TestShortestPath(string path)
        {
            IDirectedGraph <int> graph = null;

            using (var reader = new StreamReader(path))
            {
                graph = GraphHelper.ParseFromTextDirectedGraph(reader, saveReversedVersion: false);
                Console.WriteLine("Graph initiated!");
                Console.WriteLine(graph);
            }

            int startVertex = 1, endVertex = 9;
            var shortestPath = GraphSearch.ComputeShortestPath(graph, startVertex, endVertex);

            Console.WriteLine($"Shortest path in graph from vertex {startVertex} to {endVertex} is {shortestPath}");
        }