示例#1
0
        public void DijkstraAlgorithm(GraphTrain graph, Vertex initialVertex)
        {
            this.Selections    = new List <Vertex>();
            this.VD            = new List <DijkstraElement>();
            this.Graph         = graph;
            this.InitialVertex = initialVertex;

            ClearDijkstra();

            foreach (Vertex v in Graph.VertexList)
            {
                if (v.Name != InitialVertex.Name)
                {
                    VD.Add(new DijkstraElement(v, false, Double.MaxValue));
                }
                else
                {
                    VD.Add(new DijkstraElement(v, false, 0, v));
                }
            }

            while (!IsSolution())
            {
                v_d = SelectDefinitve();
                if (v_d == null)
                {
                    break;
                }
                UpdateVD();
                Selections.Add(v_d);
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     this.Graph          = new GraphTrain();
     this.ImagenOriginal = new Bitmap(pictureBox1.Image);
     this.Temp           = new Bitmap(pictureBox1.Image);
     this.Dijkstra       = new Dijkstra();
     FillComboBox();
 }