Exemplo n.º 1
0
        private void Dijkstra(object sender, RoutedEventArgs e)
        {
            var dialog = new Dijkstra();

            dialog.ShowDialog();

            int startNode = dialog.StartNode - 1;
            int endNode   = dialog.EndNode - 1;

            List <int> path = PathFinding.Dijkstra(Graph, startNode, endNode);

            string message = "Znaleziona sciezka : " + Environment.NewLine;

            if (path != null)
            {
                path.ForEach(n => message += (n + 1) + " ");
            }
            else
            {
                message = "Nie znaleziono sciezki";
            }

            MessageBox.Show(message);
        }
Exemplo n.º 2
0
        public static List <GraphNode> ShowMinPath(GraphNode from, GraphNode to)
        {
            Dijkstra dijkstra = new Dijkstra();

            return(dijkstra.FindShortestPath(from, to));
        }