Exemple #1
0
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            if (loadFrom == "")
                return;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                int startYear, endYear;
                YearRangeForm range = new YearRangeForm();
                range.from = currentYear;
                range.to = currentYear;
                range.ShowDialog();
                startYear = range.from;
                endYear = range.to;

                ProgressForm progress = new ProgressForm();
                progress.endYear = endYear;
                progress.startYear = startYear;
                progress.curYear = 0;
                progress.Show();

                int previousYear = -1;
                for (int year = startYear; year <= endYear; ++year)
                {
                    if (loadFrom == "Matrix")
                    {
                        year = net.LoadFromMatrixFile(openFileDialog.FileName, year);
                    }
                    else if (loadFrom == "Dyadic")
                    {
                        year = net.LoadFromDyadicFile(openFileDialog.FileName, year);
                    }
                    else if (loadFrom == "Random")
                    {
                        net.LoadRandom(_randomForm.N, "Data", _randomSymmetric, _randomForm.ProbRange, _randomForm.MinProb, _randomForm.MaxProb, _randomForm.RandomN, _randomForm.RandomMinN, _randomForm.RandomMaxN, _randomForm.RandomIntN);
                    }
                    else if (loadFrom == "ValuedRandom")
                    {
                        net.LoadValuedRandom(_vrandomForm.N, "Data", _randomSymmetric, _vrandomForm.vmin, _vrandomForm.vmax, _vrandomForm.datatype, _vrandomForm.zerodiagonalized, _vrandomForm.ProbRange, _vrandomForm.MinProb, _vrandomForm.MaxProb, _vrandomForm.RandomN, _vrandomForm.RandomMinN, _vrandomForm.RandomMaxN, _vrandomForm.RandomIntN);
                    }
                    if (year != previousYear && year <= endYear)
                    {
                        net.FindCliques(_optionsForm.Cutoff[currentYear], _optionsForm.InputType != "None", _optionsForm.Density, currentYear, _optionsForm.CMinMembers, false, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag);
                        net.LoadViableCoalitions(_optionsForm.ViableCoalitionCutoff, currentYear, _optionsForm.svcCoalitionFile);

                        Network.NetworkGUI viableNet = new Network.NetworkGUI(net);
                        viableNet.LoadCounterIntoDataGridView(dataGrid, currentYear, _optionsForm.Cutoff[currentYear], _optionsForm.Density,
                            _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion,
                            _optionsForm.transitivityType, _optionsForm.counterOptions, _optionsForm.reachSum, _optionsForm.reachZero, _optionsForm.ReachNumMatrices, _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag, _optionsForm.SelectionMethod, net._minCliqueSize);

                        switch (_optionsForm.SelectionMethod)
                        {
                            case "Cliq":
                                bool temp = false;
                                if (_optionsForm.counterOptions[10] || _optionsForm.counterOptions[11] || _optionsForm.counterOptions[14] || _optionsForm.counterOptions[18] || _optionsForm.counterOptions[24])
                                    temp = true;
                                net.FindCliques(_optionsForm.Cutoff[currentYear], _optionsForm.InputType == "StructEquiv",
                                    _optionsForm.Density, currentYear, net._minCliqueSize, temp, _optionsForm.KCliqueValue,
                                    _optionsForm.KCliqueDiag);
                                net.LoadCounterIntoDataGridView(dataGrid, currentYear, _optionsForm.Cutoff[currentYear], _optionsForm.Density,
                                                                _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion,
                                                                _optionsForm.transitivityType, _optionsForm.counterOptions, _optionsForm.reachSum, _optionsForm.reachZero,
                                                                _optionsForm.ReachNumMatrices, _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue,
                                                                _optionsForm.KCliqueDiag, _optionsForm.SelectionMethod, net._minCliqueSize);
                                break;
                            case "Bloc":
                                _blocForm2.ShowDialog();
                                net.CONCOR(_blocForm2.pos, openFileDialog.Multiselect, GetCONCORConvergenceFunction(), _blocForm2.MaxNoSteps);
                                net.LoadBlockMatrices(_optionsForm.Density, currentYear);
                                net.LoadCounterIntoDataGridView(dataGrid, currentYear, _blocForm2.pos, _optionsForm.Density,
                                                                _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion,
                                                                _optionsForm.transitivityType, _optionsForm.counterOptions, _optionsForm.reachSum, _optionsForm.reachZero,
                                                                _optionsForm.ReachNumMatrices, _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue,
                                                                _optionsForm.KCliqueDiag, _optionsForm.SelectionMethod, _blocForm2.MaxNoSteps);
                                break;
                            case "Clus":
                                _clusterForm.ShowDialog();
                                net.LoadClustering(_clusterForm.ClusteringMethod, _clusterForm.MaxNoClusters, currentYear, _optionsForm.Density);
                                net.LoadBlockMatrices(_optionsForm.Density, currentYear);
                                net.LoadCounterIntoDataGridView(dataGrid, currentYear, _optionsForm.Cutoff[currentYear], _optionsForm.Density,
                                                                 _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion,
                                                                 _optionsForm.transitivityType, _optionsForm.counterOptions, _optionsForm.reachSum, _optionsForm.reachZero,
                                                                 _optionsForm.ReachNumMatrices, _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue,
                                                                 _optionsForm.KCliqueDiag, _optionsForm.SelectionMethod, net._minCliqueSize);
                                break;
                            case "Comm":
                                net.calculateCommunities(dataGrid, CommunityType.Affil, currentYear, _comForm.SVC, _comForm.DVC, _comForm.attrMatrix, _optionsForm.getCutOff(currentYear), _optionsForm.Density);
                                net.LoadCounterIntoDataGridView(dataGrid, currentYear, _optionsForm.Cutoff[currentYear], _optionsForm.Density,
                                                                _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion,
                                                                _optionsForm.transitivityType, _optionsForm.counterOptions, _optionsForm.reachSum, _optionsForm.reachZero,
                                                                _optionsForm.ReachNumMatrices, _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue,
                                                                _optionsForm.KCliqueDiag, _optionsForm.SelectionMethod, net._minCliqueSize);
                                break;
                            default:
                                break;
                        }
                        viableNet.SaveCounterToFile(saveFileDialog.FileName, year, year == startYear, ",", _optionsForm.Cutoff[year], _optionsForm.Density,
                            _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion, _optionsForm.transitivityType,
                            _optionsForm.counterOptions, _optionsForm.SaveOverwrite && year == startYear, _optionsForm.reachZero, _optionsForm.reachSum, _optionsForm.ReachNumMatrices,
                            _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag, _optionsForm.SelectionMethod);
                    }
                    progress.curYear = year;
                    Application.DoEvents();
                    previousYear = year;
                }

                if (currentYear == endYear)
                    return;

                if (loadFrom == "Matrix")
                {
                    net.LoadFromMatrixFile(openFileDialog.FileName, currentYear);
                }
                else if (loadFrom == "Dyadic")
                {
                    net.LoadFromDyadicFile(openFileDialog.FileName, currentYear);
                }
            }
        }
Exemple #2
0
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            if (loadFrom == "")
                return;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                int startYear, endYear;
                YearRangeForm range = new YearRangeForm();
                range.from = currentYear;
                range.to = currentYear;
                range.ShowDialog();
                startYear = range.from;
                endYear = range.to;

                ProgressForm progress = new ProgressForm();
                progress.endYear = endYear;
                progress.startYear = startYear;
                progress.curYear = 0;
                progress.Show();

                int previousYear = -1;
                for (int year = startYear; year <= endYear; ++year)
                {
                    if (loadFrom == "Matrix")
                    {
                        year = net.LoadFromMatrixFile(openFileDialog.FileName, year);
                    }
                    else if (loadFrom == "Dyadic")
                    {
                        year = net.LoadFromDyadicFile(openFileDialog.FileName, year);
                    }
                    else if (loadFrom == "Random")
                    {
                        net.LoadRandom(_randomForm.N, "Data", _randomSymmetric, _randomForm.ProbRange, _randomForm.MinProb, _randomForm.MaxProb, _randomForm.RandomN, _randomForm.RandomMinN, _randomForm.RandomMaxN, _randomForm.RandomIntN);
                    }
                    else if (loadFrom == "ValuedRandom")
                    {
                        net.LoadValuedRandom(_vrandomForm.N, "Data", _randomSymmetric, _vrandomForm.vmin, _vrandomForm.vmax, _vrandomForm.datatype, _vrandomForm.zerodiagonalized, _vrandomForm.ProbRange, _vrandomForm.MinProb, _vrandomForm.MaxProb, _vrandomForm.RandomN, _vrandomForm.RandomMinN, _vrandomForm.RandomMaxN, _vrandomForm.RandomIntN);
                    }
                    if (year != previousYear && year <= endYear)
                    {
                        net.FindCliques(_optionsForm.Cutoff[currentYear], _optionsForm.InputType != "None", _optionsForm.Density, currentYear, _optionsForm.CMinMembers, false, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag);
                        net.LoadViableCoalitions(_optionsForm.ViableCoalitionCutoff, currentYear, _optionsForm.svcCoalitionFile);

                        Network.NetworkGUI viableNet = new Network.NetworkGUI(net);
                        viableNet.LoadCounterIntoDataGridView(dataGrid, currentYear, _optionsForm.Cutoff[currentYear], _optionsForm.Density,
                            _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion,
                            _optionsForm.transitivityType, _optionsForm.counterOptions, _optionsForm.reachSum, _optionsForm.reachZero, _optionsForm.ReachNumMatrices, _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag);

                        viableNet.SaveCounterToFile(saveFileDialog.FileName, year, year == startYear, ",", _optionsForm.Cutoff[year], _optionsForm.Density,
                            _optionsForm.InputType, _optionsForm.FileName, _optionsForm.svcFile, _optionsForm.useCohesion, _optionsForm.transitivityType,
                            _optionsForm.counterOptions, _optionsForm.SaveOverwrite && year == startYear, _optionsForm.reachZero, _optionsForm.reachSum, _optionsForm.ReachNumMatrices, _optionsForm.ERPOLType, _optionsForm.Alpha, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag);
                    }
                    progress.curYear = year;
                    Application.DoEvents();
                    previousYear = year;
                }

                if (currentYear == endYear)
                    return;

                if (loadFrom == "Matrix")
                {
                    net.LoadFromMatrixFile(openFileDialog.FileName, currentYear);
                }
                else if (loadFrom == "Dyadic")
                {
                    net.LoadFromDyadicFile(openFileDialog.FileName, currentYear);
                }
            }
        }