private void LoadData() { net.ClearPreviousData(displayMatrix, loadFrom); // Load matrix into GUI DoStandardize(); // Thread t = new Thread(delegate() { DoLoadCorrect(currentYear); }); // t.Start(); //while (!t.IsAlive) ; // Thread.Sleep(100); // t.Join(); DoLoadCorrect(currentYear); switch (displayMatrix) { case "Affiliation": if (_optionsForm.DisplayCliqueOption == "Save") SaveAffiliationWithoutDisplay(); else net.LoadAffiliationIntoDataGridView(dataGrid, _optionsForm.Cutoff[currentYear], _optionsForm.InputType == "StructEquiv", _optionsForm.FileName, _optionsForm.InputType == "Dyadic", currentYear, _optionsForm.Density, _optionsForm.InputType != "None", _optionsForm.SumMean, _optionsForm.SumMeanFilename, _optionsForm.svcFile, _optionsForm.DisplayCliqueOption, cliqueSizeToolStripMenuItem1.Checked, cliqueCohesionToolStripMenuItem1.Checked, estebanRayIndexToolStripMenuItem1.Checked, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag); break; case "ViableCounter": 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); break; case "CONCOR": net.LoadBlocAffiliationIntoDataGridView(dataGrid, false); break; case "Clustering": net.LoadBlocAffiliationIntoDataGridView(dataGrid, true); break; case "NatDep": net.LoadNationalDependencyIntoDataGridView(_optionsForm.ReachNumMatrices, _optionsForm.Density, currentYear, _optionsForm.reachZero, _optionsForm.reachSum); net.LoadMatrixIntoDataGridView(dataGrid, displayMatrix); break; case "CBCO": if (_optionsForm.DisplayCliqueOption == "Save") SaveAffiliationWithoutDisplay(); else { // Thread v = new Thread(delegate() { net.LoadCBCOverlapIntoDataGridView(dataGrid, _optionsForm.DisplayCliqueOption); }); // v.Start(); // while (!v.IsAlive) ; // Thread.Sleep(100); // v.Join(); net.LoadCBCOverlapIntoDataGridView(dataGrid, _optionsForm.DisplayCliqueOption); } break; case "CBCODiag": if (_optionsForm.DisplayCliqueOption == "Save") SaveAffiliationWithoutDisplay(); else net.LoadCBCOverlapIntoDataGridView(dataGrid, true, _optionsForm.DisplayCliqueOption); break; case "Centrality": net.LoadCentralityIntoDataGridView(dataGrid, _centralityForm.Avg); break; case "Components": net.LoadComponentsIntoDataGridView(dataGrid, _optionsForm.Cutoff[currentYear], _optionsForm.InputType == "StructEquiv", _optionsForm.FileName, _optionsForm.InputType == "Dyadic", currentYear, _optionsForm.Density, _optionsForm.InputType != "None", _optionsForm.SumMean, _optionsForm.SumMeanFilename, _optionsForm.svcFile, cliqueSizeToolStripMenuItem1.Checked, cliqueCohesionToolStripMenuItem1.Checked, estebanRayIndexToolStripMenuItem1.Checked, _optionsForm.KCliqueValue, _optionsForm.KCliqueDiag); break; case "Counter": break; case "Community": break; // new code for local Transitivity case "LocalTransitivity": break; case "LocalBalance": break; case "SignedNetwork": //net.LoadSignedNetworkCharacteristics(dataGrid, _optionsForm.ReachNumMatrices, _optionsForm.reachSum, _optionsForm.reachZero, prevDisplayMatrix, currentYear, reachBinary); break; case "SingleNetworkExpectations": break; case "NetworkSpilloverStatistics": break; default: net.LoadMatrixIntoDataGridView(dataGrid, displayMatrix); break; } //net.ClearPreviousData(displayMatrix); }
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); } } }
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); } } }