Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Prim X = new Prim();

            Prim.prim();
            textBox1.Text = Prim.mstCost.ToString();
        }
Exemplo n.º 2
0
        public void start()
        {
            getDistincitColors = new Distictit_Colors(ImageMatrix);
            //Get The Distincit Colors
            colors = getDistincitColors.getDistincitColors();
            //An Object To Calculate The Minimum Spanning Tree
            Prim prim = new Prim();

            //List To Save The Edges The Resulting Minimum Spanning Tree
            edges = new List <KeyValuePair <KeyValuePair <int, int>, double> >();
            //The Total Sum Of The MST
            double sum = prim.getMst(ref edges, colors.Count, colors);

            MessageBox.Show(edges.Count.ToString());
            //Display The # Distinct Colors In The Width's Text Box
            txtWidth.Text = (colors.Count - 1).ToString();
            //Display The Sum Of The MST In The Height's Text Box
            txtHeight.Text = sum.ToString();
        }
Exemplo n.º 3
0
        // Return the function with the smallest cost



        private void btnQ_Click(object sender, EventArgs e)
        {
            var distTime = new Stopwatch();

            distTime.Start();
            var distinctColors = CountDistinctColors();

            distTime.Stop();
            txtDistinctColors.Text     = distinctColors.Count.ToString();
            txtDistinctColorsTime.Text = distTime.Elapsed.ToString();

            var mstTime = new Stopwatch();

            mstTime.Start();
            var prim = new Prim(distinctColors.Count);
            var ans  = prim.MstPrim(distinctColors);

            mstTime.Stop();
            txtMstCost.Text     = ans.ToString();
            txtMstCostTime.Text = mstTime.Elapsed.ToString();
        }