public Researches() { InitializeComponent(); this.storage = new XMLResultStorage(ConfigurationManager. AppSettings[ConfigurationManager.AppSettings["Storage"]]); this.researches = storage.LoadAllResearches(); }
public void ERClusteringCoefficientTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("EROutput.xml"); ERContainer container = new ERContainer(); container.SetMatrix("ERInput.txt"); AbstarctGraphAnalyzer analyzer = new ERAnalyzer(container); SortedDictionary<double, int> actualValue = analyzer.GetClusteringCoefficient(); SortedDictionary<double, int> expectedValue = goldResult.Results[0].Coefficient; Assert.IsTrue(compare(actualValue, expectedValue)); }
public void ERAveragePathTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("EROutput.xml"); ERContainer container = new ERContainer(); container.SetMatrix("ERInput.txt"); AbstarctGraphAnalyzer analyzer = new ERAnalyzer(container); double actualValue = analyzer.GetAveragePath(); double expectedValue = goldResult.Results[0].Result[AnalyseOptions.AveragePath]; Assert.AreEqual(actualValue, expectedValue); }
public void WSModelTest() { XMLResultStorage resultStorage = new XMLResultStorage("C:\\ComplexNetwork"); ResultAssembly goldResult = resultStorage.Load(new Guid("3c1a04a6-8869-4c8b-9213-6eed61125a5c")); WSGraph graph = new WSGraph(get_data("C:\\Users\\Artak\\Desktop\\Complex Network\\ModelsTests\\testData\\test.txt")); IGraphAnalyzer analyzer = new WSAnalyzer(graph.Container); Assert.AreEqual(goldResult.Results[0].Result[AnalyseOptions.AveragePath], analyzer.GetAveragePath()); Assert.AreEqual(goldResult.Results[0].Result[AnalyseOptions.AveragePath], analyzer.GetAveragePath()); Assert.AreEqual(goldResult.Results[0].Result[AnalyseOptions.AveragePath], analyzer.GetAveragePath()); Assert.AreEqual(goldResult.Results[0].Result[AnalyseOptions.AveragePath], analyzer.GetAveragePath()); Assert.AreEqual(goldResult.Results[0].Result[AnalyseOptions.AveragePath], analyzer.GetAveragePath()); }
public void BACycles4Test() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("BAOutput.xml"); BAContainer container = new BAContainer(); container.SetMatrix("BAInput.txt"); AbstarctGraphAnalyzer analyzer = new BAAnalyzer(container); long actualValue = analyzer.GetCycles4(); double expectedValue = goldResult.Results[0].Result[AnalyseOptions.Cycles4]; Assert.AreEqual(actualValue, expectedValue); }
public void ERCycles3Test() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("EROutput.xml"); ERContainer container = new ERContainer(); container.SetMatrix("ERInput.txt"); AbstarctGraphAnalyzer analyzer = new ERAnalyzer(container); long actualValue = analyzer.GetCycles3(); long expectedValue = (long)goldResult.Results[0].Result[AnalyseOptions.Cycles3]; Assert.AreEqual(actualValue, expectedValue); }
public void Cycles3Test() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("WSOutput.xml"); WSContainer container = new WSContainer(); container.SetMatrix("WSInput.txt"); AbstarctGraphAnalyzer analyzer = new WSAnalyzer(container); long actualValue = analyzer.GetCycles3(); long expectedValue = goldResult.Results[0].Cycles3; Assert.AreEqual(actualValue, expectedValue); }
public void BADistEigenPathTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("BAOutput.xml"); BAContainer container = new BAContainer(); container.SetMatrix("BAInput.txt"); AbstarctGraphAnalyzer analyzer = new BAAnalyzer(container); SortedDictionary<double, int> actualValue = analyzer.GetDistEigenPath(); SortedDictionary<double, int> expectedValue = goldResult.Results[0].DistancesBetweenEigenValues; Assert.IsTrue(compare(actualValue, expectedValue)); }
public void ERMinPathDistTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("EROutput.xml"); ERContainer container = new ERContainer(); container.SetMatrix("ERInput.txt"); AbstarctGraphAnalyzer analyzer = new ERAnalyzer(container); SortedDictionary<int, int> actualValue = analyzer.GetMinPathDist(); SortedDictionary<int, int> expectedValue = goldResult.Results[0].DistanceBetweenVertices; Assert.IsTrue(compare(actualValue, expectedValue)); }
public void EREigenValueTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("EROutput.xml"); ERContainer container = new ERContainer(); container.SetMatrix("ERInput.txt"); AbstarctGraphAnalyzer analyzer = new ERAnalyzer(container); ArrayList actualValue = analyzer.GetEigenValues(); ArrayList expectedValue = goldResult.Results[0].EigenVector; Assert.IsTrue(compare(actualValue, expectedValue)); }
public void ERCyclesTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("EROutput.xml"); ERContainer container = new ERContainer(); container.SetMatrix("ERInput.txt"); AbstarctGraphAnalyzer analyzer = new ERAnalyzer(container); SortedDictionary<int, long> actualValue = analyzer.GetCycles(4, 6); SortedDictionary<int, long> expectedValue = goldResult.Results[0].Cycles; Assert.IsTrue(compare(actualValue, expectedValue)); }
private void xmlToSql_Click(object sender, EventArgs e) { IResultStorage sqlStorage = new SQLResultStorage(new ConnectionStringSettings("a", this.sqlStorageConnTxt.Text, "System.Data.SqlClient")); IResultStorage xmlStorage = new XMLResultStorage(this.xmlStorageLocationTxt.Text); FreezeButtons(true); TransferData(xmlStorage, sqlStorage); FreezeButtons(false); }
private void startGlobal_Click(object sender, EventArgs e) { Int16 p = Int16.Parse(this.branchIndexCmb.Text); Int16 maxLevel = Int16.Parse(this.maxLevelCmb.Text); int realizationCount = (Int32)this.realizationCountNum.Value; double muLow = Double.Parse(this.muRangeLowExtendedTxt.Text); double muHigh = Double.Parse(this.muRangeHighExtendedTxt.Text); double muDelta = Double.Parse(this.deltaExtendedTxt.Text); ResultResearch result = new ResultResearch(); result.Name = this.jobName; result.ModelType = typeof(HierarchicModel); result.Delta = muDelta; result.RealizationCount = realizationCount; result.Function = this.probabilityFunctionCmb.Text; result.GenerationParams[GenerationParam.BranchIndex] = p; result.GenerationParams[GenerationParam.Level] = maxLevel; result.Size = (int)Math.Pow(p, maxLevel); result.Result.Add(maxLevel, new SortedDictionary<double, SubGraphsInfo>()); Dictionary<GenerationParam, object> genParameters = new Dictionary<GenerationParam, object>(); genParameters.Add(GenerationParam.BranchIndex, p); genParameters.Add(GenerationParam.Level, maxLevel); HierarchicGenerator hGenerator = new HierarchicGenerator(); HierarchicAnalyzer hAnalyzer; double muTemp = muLow; SortedDictionary<int, int> subGraphInfo = new SortedDictionary<int,int>(); while (muTemp <= muHigh) { SubGraphsInfo tempInfo = new SubGraphsInfo(); for (int r = 0; r < realizationCount; ++r) { genParameters[GenerationParam.Mu] = muTemp; hGenerator.Generation(genParameters); hAnalyzer = new HierarchicAnalyzer((HierarchicContainer)hGenerator.Container); subGraphInfo = hAnalyzer.GetConnSubGraph(); tempInfo.avgOrder += subGraphInfo.Last().Key; tempInfo.avgOrderCount += subGraphInfo.Last().Value; if (subGraphInfo.Count > 1) { subGraphInfo.Remove(subGraphInfo.Last().Key); tempInfo.secondMax += subGraphInfo.Last().Key; tempInfo.secondMaxCount += subGraphInfo.Last().Value; } if (subGraphInfo.Count > 2) { subGraphInfo.Remove(subGraphInfo.Last().Key); tempInfo.avgOrderRest += subGraphInfo.Average(x => x.Key); } } tempInfo.avgOrder /= (double)realizationCount; tempInfo.avgOrder /= result.Size; tempInfo.avgOrderCount /= (double)realizationCount; tempInfo.secondMax /= (double)realizationCount; tempInfo.secondMax /= result.Size; tempInfo.secondMaxCount /= (double)realizationCount; tempInfo.avgOrderRest /= (double)realizationCount; tempInfo.avgOrderRest /= result.Size; result.Result[maxLevel].Add(muTemp, tempInfo); muTemp += muDelta; } XMLResultStorage storage = new XMLResultStorage(Options.StorageDirectory); storage.SaveResearch(result); MessageBox.Show("Results are saved succesfully!"); }
public void BADegreeDistributionTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("BAOutput.xml"); BAContainer container = new BAContainer(); container.SetMatrix("BAInput.txt"); AbstarctGraphAnalyzer analyzer = new BAAnalyzer(container); SortedDictionary<int, int> actualValue = analyzer.GetDegreeDistribution(); SortedDictionary<int, int> expectedValue = goldResult.Results[0].VertexDegree; Assert.IsTrue(compare(actualValue, expectedValue)); }
private void constructGraph(string modelName) { try { XMLResultStorage resultStorage = new XMLResultStorage(""); goldResult = resultStorage.LoadXML(goldenOutPath.Text); } catch (Exception e) { MessageBox.Show(this, "Unable load XML file", e.Message); } switch (modelName) { case "Barabasi-Albert": BAContainer baContainer = new BAContainer(); baContainer.SetMatrix(inputMatrixPath.Text); BAModelTest(baContainer); break; case "ERModel": ERContainer erContainer = new ERContainer(); erContainer.SetMatrix(inputMatrixPath.Text); ERModelTest(erContainer); break; case "Watts-Strogatz": WSContainer wsContainer = new WSContainer(); wsContainer.SetMatrix(inputMatrixPath.Text); WSModelTest(wsContainer); break; default: Console.WriteLine("Default case"); break; } }
public void FullSubGraphTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("WSOutput.xml"); WSContainer container = new WSContainer(); container.SetMatrix("WSInput.txt"); AbstarctGraphAnalyzer analyzer = new WSAnalyzer(container); SortedDictionary<int, int> actualValue = analyzer.GetFullSubGraph(); SortedDictionary<int, int> expectedValue = goldResult.Results[0].FullSubgraphs; Assert.IsTrue(compare(actualValue, expectedValue)); }
private void startHierarchic_Click(object sender, EventArgs e) { ResultResearch result = new ResultResearch(); result.Name = this.jobName; result.ModelType = typeof(HierarchicModel); result.Delta = Double.Parse(this.deltaExtendedTxt.Text); result.RealizationCount = (Int32)this.realizationCountNum.Value; result.Function = this.probabilityFunctionCmb.Text; result.GenerationParams[GenerationParam.BranchIndex] = Int16.Parse(this.branchIndexCmb.Text); result.GenerationParams[GenerationParam.Level] = Int16.Parse(this.maxLevelCmb.Text); result.Size = (int)Math.Pow(Int16.Parse(this.branchIndexCmb.Text), Int16.Parse(this.maxLevelCmb.Text)); Int16 maxLevel = Int16.Parse(this.maxLevelCmb.Text); for (Int16 g = 1; g <= maxLevel; ++g) { result.Result.Add(g, new SortedDictionary<double, SubGraphsInfo>()); } double muLow = Double.Parse(this.muRangeLowExtendedTxt.Text); double muHigh = Double.Parse(this.muRangeHighExtendedTxt.Text); double muDelta = Double.Parse(this.deltaExtendedTxt.Text); double muTemp = muLow; SubGraphsInfo tempInfo = new SubGraphsInfo(); while (muTemp < muHigh) { SortedDictionary<double, SubGraphsInfo> r = AnalyzeHierarchic(muTemp); foreach (double gamma in r.Keys) { result.Result[gamma].Add(muTemp, r[gamma]); } muTemp += muDelta; } XMLResultStorage storage = new XMLResultStorage(Options.StorageDirectory); storage.SaveResearch(result); MessageBox.Show("Results are saved succesfully!"); }
public void BAMotivesTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("BAOutput.xml"); BAContainer container = new BAContainer(); container.SetMatrix("BAInput.txt"); AbstarctGraphAnalyzer analyzer = new BAAnalyzer(container); SortedDictionary<int, float> actualValue = analyzer.GetMotivs(2, 4); SortedDictionary<int, float> expectedValue = goldResult.Results[0].MotivesCount; Assert.IsTrue(compare(actualValue, expectedValue)); }
/*private void startExtended_Click(object sender, EventArgs e) { ResultResearch result = new ResultResearch(); result.Name = this.jobName; result.ModelType = typeof(HierarchicModel); result.Delta = Double.Parse(this.deltaExtendedTxt.Text); result.RealizationCount = (Int32)this.realizationCountNum.Value; result.Function = this.probabilityFunctionCmb.Text; result.GenerationParams[GenerationParam.BranchIndex] = Int16.Parse(this.branchIndexCmb.Text); result.GenerationParams[GenerationParam.Level] = Int16.Parse(this.maxLevelCmb.Text); result.Size = (int)Math.Pow(Int16.Parse(this.branchIndexCmb.Text), Int16.Parse(this.maxLevelCmb.Text)); Int16 maxLevel = Int16.Parse(this.maxLevelCmb.Text); for (Int16 g = 1; g <= maxLevel; ++g) { result.Result.Add(g, AnalyzeExtendedHierarchic(g)); } XMLResultStorage storage = new XMLResultStorage(Options.StorageDirectory); storage.SaveResearch(result); MessageBox.Show("Results are saved succesfully!"); }*/ private void startER_Click(object sender, EventArgs e) { ResultResearch result = new ResultResearch(); result.Name = this.jobName; result.ModelType = typeof(ERModel); // TODO remove hardcoded data result.Delta = 0.00001; result.RealizationCount = 100; result.GenerationParams[GenerationParam.Vertices] = 65536; SortedDictionary<double, SubGraphsInfo> pInfo = new SortedDictionary<double, SubGraphsInfo>(); this.folderBrowserDialog1.ShowDialog(); string dirName = this.folderBrowserDialog1.SelectedPath; DirectoryInfo parentDir = new DirectoryInfo(dirName); foreach (FileInfo f in parentDir.GetFiles()) { double p = Double.Parse(f.Name.Remove(f.Name.Length - 4)); SubGraphsInfo value = new SubGraphsInfo(); SortedDictionary<int, double> r = new SortedDictionary<int, double>(); using (StreamReader streamReader = new StreamReader(f.FullName, System.Text.Encoding.Default)) { string contents; while ((contents = streamReader.ReadLine()) != null) { string first = "", second = ""; int j = 0; while (contents[j] != ' ') { first += contents[j]; ++j; } second = contents.Substring(j); r.Add(int.Parse(first), double.Parse(second)); } } value.avgOrder = r.First().Value; value.avgOrderCount = r.First().Key; if (r.Count > 1) { r.Remove(r.First().Key); value.secondMax = r.First().Value; value.secondMaxCount = r.First().Key; } if (r.Count > 2) { r.Remove(r.First().Key); value.avgOrderRest = r.Average(x => x.Value); } pInfo.Add(p, value); } result.Result.Add(1, pInfo); XMLResultStorage storage = new XMLResultStorage(Options.StorageDirectory); storage.SaveResearch(result); MessageBox.Show("Results are saved succesfully!"); }