Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            int N                 = int.Parse(textBox4.Text);
            int N_init            = int.Parse(textBox6.Text);
            int E                 = int.Parse(textBox3.Text);;
            BarabasiAlbertModel g = new BarabasiAlbertModel(N, false, false, N_init, E);

            Data.RandomNetwork d = g.Generate();
            if (radioButton6.Checked)
            {
                if (visualize)
                {
                    var    graphviz = new GraphvizAlgorithm <int, UndirectedEdge <int> >(d.MGraph);
                    string output   = graphviz.Generate(new FileDotEngine(), "graph");
                    pictureBox2.ImageLocation = "graph.png";
                }
                label4.Text = string.Format(@"{0}", d.ClusteringCoefficient());
                var degreeDistribuition = d.DegreeDistribuition();


                ErdosDistribuitionDegreeChart.Titles.Add(new Title(RandomGraphStrings.DegreeChartTitle));

                GenerateDegreeDistribuitionChart(chart1, degreeDistribuition);
            }
            if (radioButton5.Checked)
            {
                GenerateAveragePathLengthBarabasiChart(chart7, N, N_init, E);
                GenerateClusteringCoefficientChartBarabasi(chart6, N, N_init, E);
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int N = int.Parse(textBox1.Text);
            int k = int.Parse(textBox5.Text);
            //int iter = N;
            double p = 0.0;

            double.TryParse(textBox2.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out p);
            WattsStrogatzModel g = new WattsStrogatzModel(N, false, false, p, k);

            Data.RandomNetwork d = g.Generate();
            if (radioButton4.Checked)
            {
                if (visualize)
                {
                    var    graphviz = new GraphvizAlgorithm <int, UndirectedEdge <int> >(d.MGraph);
                    string output   = graphviz.Generate(new FileDotEngine(), "graph");
                    pictureBox1.ImageLocation = "graph.png";
                }
                label4.Text = string.Format(@"{0}", d.ClusteringCoefficient());
                var degreeDistribuition = d.DegreeDistribuition();


                ErdosDistribuitionDegreeChart.Titles.Add(new Title(RandomGraphStrings.DegreeChartTitle));

                GenerateDegreeDistribuitionChart(chart2, degreeDistribuition);
            }
            if (radioButton3.Checked)
            {
                GenerateAveragePathLengthWattsChart(chart4, N, k);
                GenerateClusteringCoefficientChart(chart3, N, k);
            }
        }