示例#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);
        }
示例#2
0
文件: Graph.cs 项目: Nan1t/Graphs
        public static List <GraphNode> ShowMinPath(GraphNode from, GraphNode to)
        {
            Dijkstra dijkstra = new Dijkstra();

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