public AbstractNetworkAnalyzer(AbstractNetwork n) { network = n; }
private void ProbabilityDependencyAnalysis() { Console.Write("Please enter the initial number of vertecies (Default = 500): "); int initialVertexes; if (!int.TryParse(Console.ReadLine(), out initialVertexes)) { initialVertexes = 500; } Console.Write("Please enter the number of generation steps (Default = 500): "); int steps; if (!int.TryParse(Console.ReadLine(), out steps)) { steps = 500; } Console.Write("Number of edges per step (Default = 10): "); int edges; if (!int.TryParse(Console.ReadLine(), out edges)) { edges = 10; } Console.Write("Please enter the number of realization (Default = 1): "); int realizations; if (!int.TryParse(Console.ReadLine(), out realizations)) { realizations = 1; } Bounds <double, double> bounds = this.GetProbabilityBounds(); Dictionary <double, ICollection <double> > allResults = new Dictionary <double, ICollection <double> >(); for (var start = bounds.InitialValue; start <= bounds.MaxValue; start += bounds.Step) { var networks = new BANetwork[realizations]; var results = new double[realizations]; allResults[start] = results; var prob = start; Parallel.For(0, realizations, new ParallelOptions { MaxDegreeOfParallelism = this.parallel }, i => { var param = new Dictionary <GenerationParameter, object> { { GenerationParameter.Probability, prob }, { GenerationParameter.Vertices, initialVertexes }, { GenerationParameter.Edges, edges }, { GenerationParameter.StepCount, steps } }; networks[i] = (BANetwork)AbstractNetwork.CreateNetworkByType(ModelType.BA, $"Prob_{prob}_Run_{i}", ResearchType.Basic, GenerationType.Random, new Dictionary <ResearchParameter, object>(), param, AnalyzeOption.Degeneracy, ContainerMode.Fast); networks[i].Generate(); networks[i].Analyze(); results[i] = (double)networks[i].NetworkResult.Result[AnalyzeOption.Degeneracy]; }); } this.SaveProbResearchResult(allResults); Console.WriteLine("Research is completed. You can start other experiment or close app."); Console.WriteLine(); }
private void RunTest(uint matrixIndex, uint erIndex, uint hIndex, uint nhIndex) { Debug.Assert(matrixIndex < matrixFiles.Count()); MatrixPath m = new MatrixPath(); m.Path = matrixesPath + "\\" + matrixFiles[matrixIndex]; Dictionary <GenerationParameter, object> gp = new Dictionary <GenerationParameter, object>(); gp.Add(GenerationParameter.AdjacencyMatrix, m); AnalyzeOption opts = SessionManager.GetAvailableAnalyzeOptions(ResearchType.Basic, ModelType); opts &= ~AnalyzeOption.EigenValues; opts &= ~AnalyzeOption.EigenDistanceDistribution; opts &= ~AnalyzeOption.CycleDistribution; AbstractNetwork n = AbstractNetwork.CreateNetworkByType(ModelType, "", ResearchType.Basic, GenerationType.Static, new Dictionary <ResearchParameter, object>(), gp, opts, ContainerMode.Default); n.Generate(); n.Analyze(); RealizationResult rn = n.NetworkResult; ResearchResult er = null; if (erIndex < erFiles.Count()) { er = erStorage.Load(erPath + "\\" + erFiles[erIndex]); } Debug.Assert(hIndex < regularHierarchicFiles.Count()); ResearchResult hr = regularHierarchicStorage.Load(regularHierarchicPath + "\\" + regularHierarchicFiles[hIndex]); Debug.Assert(nhIndex < nonRegularHierarchicFiles.Count()); ResearchResult nhr = nonRegularHierarchicStorage.Load(nonRegularHierarchicPath + "\\" + nonRegularHierarchicFiles[nhIndex]); string s; foreach (AnalyzeOption o in rn.Result.Keys) { if (er != null) { s = Check(o, rn, er) ? "Passed" : "Failed"; optionsTable.Rows.Add(o.ToString(), er.ResearchName, s); optionsTable.FirstDisplayedScrollingRowIndex = optionsTable.RowCount - 1; Application.DoEvents(); } s = Check(o, rn, hr) ? "Passed" : "Failed"; optionsTable.Rows.Add(o.ToString(), hr.ResearchName, s); optionsTable.FirstDisplayedScrollingRowIndex = optionsTable.RowCount - 1; Application.DoEvents(); s = Check(o, rn, nhr) ? "Passed" : "Failed"; optionsTable.Rows.Add(o.ToString(), nhr.ResearchName, s); optionsTable.FirstDisplayedScrollingRowIndex = optionsTable.RowCount - 1; Application.DoEvents(); } }
private void ActivationAnalysis() { Console.Write("Please enter the number of vertecies (Default = 1024): "); if (!int.TryParse(Console.ReadLine(), out this.initialVertexes)) { this.initialVertexes = 1024; } double probability; Console.Write("Please enter the generation probability (Default = 0.01): "); if (!double.TryParse(Console.ReadLine(), out probability)) { probability = 0.01; } double delta; Console.Write("Please enter the delta value (Default = 0.001): "); if (!double.TryParse(Console.ReadLine(), out delta)) { delta = 0.001; } var param = new Dictionary <GenerationParameter, object> { { GenerationParameter.Probability, probability }, { GenerationParameter.Vertices, this.initialVertexes } }; var network = (ERNetwork)AbstractNetwork.CreateNetworkByType(ModelType.ER, $"Prob_{probability}_", ResearchType.Basic, GenerationType.Random, new Dictionary <ResearchParameter, object> { }, param, AnalyzeOption.None, ContainerMode.Fast); network.Generate(); network.Analyze(); var quick = ((IQuickGraphConverter)network.GetAnalyzer()).ToQuickGraph(); var decomposition = quick.CoreDecomposition(); var energySequence = new List <double>(); var activePortions = new List <double>(); var uValues = new List <double>(); for (var k = 1; k <= decomposition.Degeneracy + 2; ++k) { var uValue = -delta - k; uValues.Add(Math.Abs(uValue)); var kSize = decomposition.CoreDescritpros.ContainsKey(k) ? decomposition.CoreDescritpros[k] : new CoreDescriptor(k, 0, 0); var vertexPortion = kSize.VertexCount * 1.0 / quick.VertexCount; activePortions.Add(vertexPortion); var energy = -1.0 * kSize.EdgeCount / quick.VertexCount + (k - 1 + delta) * vertexPortion; energySequence.Add(energy); } this.SaveActivationResearchResult(quick, decomposition, uValues, activePortions, energySequence); }
public MatrixAnalyzer(AbstractNetwork n) : base(n) { }
public AbstractNetworkAnalyzer(AbstractNetwork n) { network = n; this.containerMode = n.GetContainerMode(); }
public NonRegularHierarchicNetworkAnalyzer(AbstractNetwork n) : base(n) { }