Exemple #1
0
 private void kruskalBtn_Click(object sender, EventArgs e)
 {
     FactoryAlgorithms.getAlgorithms(AObject.Kruskal).Run((int)verIDStart.Value);
 }
Exemple #2
0
 private void btnFB_Click(object sender, EventArgs e)
 {
     FactoryAlgorithms.getAlgorithms(AObject.FB).Run((int)verIDStart.Value, (int)verIDEnd.Value);
 }
Exemple #3
0
 private void btnBFS_Click(object sender, EventArgs e)
 {
     FactoryAlgorithms.getAlgorithms(AObject.BFS).Run((int)verIDStart.Value);
 }
Exemple #4
0
 private void dijkstra_btn_Click(object sender, EventArgs e)
 {
     FactoryAlgorithms.getAlgorithms(AObject.Dijkstra).Run((int)verIDStart.Value, (int)verIDEnd.Value);
 }
Exemple #5
0
        private void ptbArea_MouseClick(object sender, MouseEventArgs e)
        {
            int v = input.checkClickVertex(e.Location);

            if (v > -1)
            {
                switch (AlgorithmObject)
                {
                case AObject.BFS:
                    break;

                case AObject.DFS: FactoryAlgorithms.getAlgorithms(AObject.DFS).Run(v);
                    break;

                case AObject.Floyd: {
                    if (!CheckGoalClick)
                    {
                        vStart = v;
                        mainListVertex[v].Color = Color.Blue;
                        fInvalidate();
                        CheckGoalClick = true;
                        MessageBox.Show("click chon dinh ket thuc");
                    }
                    else
                    {
                        vEnd = v;
                        mainListVertex[v].Color = Color.Red;
                        fInvalidate();
                        CheckGoalClick = false;
                        FactoryAlgorithms.getAlgorithms(AObject.Floyd).Run(vStart, vEnd);
                    }
                    break;
                }

                case AObject.Dijkstra:
                {
                    if (!CheckGoalClick)
                    {
                        vStart = v;
                        mainListVertex[v].Color = Color.Blue;
                        fInvalidate();
                        CheckGoalClick = true;
                        MessageBox.Show("click chon dinh ket thuc");
                    }
                    else
                    {
                        vEnd = v;
                        mainListVertex[v].Color = Color.Red;
                        fInvalidate();
                        CheckGoalClick = false;
                        FactoryAlgorithms.getAlgorithms(AObject.Dijkstra).Run(vStart, vEnd);
                    }
                    break;
                }

                case AObject.FB: {
                    if (!CheckGoalClick)
                    {
                        vStart = v;
                        mainListVertex[v].Color = Color.Blue;
                        fInvalidate();
                        CheckGoalClick = true;
                        MessageBox.Show("click chon dinh ket thuc");
                    }
                    else
                    {
                        vEnd = v;
                        mainListVertex[v].Color = Color.Red;
                        fInvalidate();
                        CheckGoalClick = false;
                        FactoryAlgorithms.getAlgorithms(AObject.FB).Run(vStart, vEnd);
                    }
                    break;
                }

                case AObject.Kruskal:
                    FactoryAlgorithms.getAlgorithms(AObject.Kruskal).Run(v);
                    break;
                }
            }
            fInvalidate();
        }