private void BAModelTest(BAContainer container) { AbstarctGraphAnalyzer analyzer = new BAAnalyzer(container); //test tDegreeDistribution testDegreeDistribution(0, analyzer); //test AveragePath testAveragePath(1, analyzer); //test ClusteringCoefficient testClusteringCoefficient(2, analyzer); //test EigenValue testEigenValue(3, analyzer); //test Cycles of order 3 testCycles3(4, analyzer); // test diameter testDiameter(5, analyzer); // test cycle of order 4 testCycles4(6, analyzer); // test distance between vertexes testDistanceBetweenVertices(7, analyzer); // test distance between eigen values testDistancesBetweenEigenValues(8, analyzer); // test order of max full subgraph testFullSubgraphs(9, analyzer); }
public CyclesCounterSingleThreaded(BAContainer container) { _container = container; _verticesCount = _container.Size; _marked = new bool[_verticesCount]; for (int i = 0; i < _verticesCount; ++i) { unmark(i); } _stack = new Stack<int>(); _path = new Stack<int>(); }
public void BACycles3Test() { 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.GetCycles3(); double expectedValue = goldResult.Results[0].Result[AnalyseOptions.Cycles3]; Assert.AreEqual(actualValue, expectedValue); }
public void BAClusteringCoefficientTest() { 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.GetClusteringCoefficient(); SortedDictionary<double, int> expectedValue = goldResult.Results[0].Coefficient; Assert.IsTrue(compare(actualValue, expectedValue)); }
public CyclesCounter(BAContainer container) { _container = container; _verticesCount = _container.Size; _counter = new CyclesParallelCounter(container); }
/// <summary> /// create and returns graph in data from given BAContainer type graph /// </summary> /// <param name="graph"></param> /// <returns></returns> public static Graph reformatToOurGraghFromBAContainer(BAContainer graph) { Graph newGraph = new Graph(); bool[,] matrix = new bool[graph.Neighbourship.Count, graph.Neighbourship.Count]; List<int> list = new List<int>(); SortedDictionary<int, List<int>> neighbourship = graph.Neighbourship; for (int i = 0; i < neighbourship.Count; i++) { list = neighbourship[i]; newGraph.Vertices.Add(new Vertice(i)); for (int j = 0; j < list.Count; j++) newGraph.Edges.Add(new Edge(i, list[j])); } return newGraph; }
// Конструктор, получающий контейнер графа. public BAAnalyzer(BAContainer c) { log.Info("Creating BAAnalizer object."); container = c; Initialization(); }
public void BACyclesTest() { 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, long> actualValue = analyzer.GetCycles(4, 6); SortedDictionary<int, long> expectedValue = goldResult.Results[0].Cycles; Assert.IsTrue(compare(actualValue, expectedValue)); }
public void BAMinPathDistTest() { 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.GetMinPathDist(); SortedDictionary<int, int> expectedValue = goldResult.Results[0].DistanceBetweenVertices; Assert.IsTrue(compare(actualValue, expectedValue)); }
public void BAEigenValueTest() { XMLResultStorage resultStorage = new XMLResultStorage(""); ResultAssembly goldResult = resultStorage.LoadXML("BAOutput.xml"); BAContainer container = new BAContainer(); container.SetMatrix("BAInput.txt"); AbstarctGraphAnalyzer analyzer = new BAAnalyzer(container); ArrayList actualValue = analyzer.GetEigenValues(); ArrayList expectedValue = goldResult.Results[0].EigenVector; Assert.IsTrue(compare(actualValue, expectedValue)); }
public CyclesParallelCounter(BAContainer container) { _container = container; _verticesCount = _container.Size; _counters = new PivotsCyclesCounter[_verticesCount]; }
public PivotsCyclesCounter(IThreadEventHandler handler, BAContainer container, int pivot, int cycleLength) { _handler = handler; _container = container; _pivot = pivot; _cycleLength = cycleLength; }
private void Generate(long stepCount,double probability) { if (initialGeneration) { GenereateInitialGraph(probability); if (initialGragh.Equals("Permanent")) initialGeneration = false; container = initialcontainer; } while (stepCount > 0) { double[] probabilyArray = container.CountProbabilities(); container.AddVertex(); container.RefreshNeighbourships(MakeGenerationStep(probabilyArray)); --stepCount; } }
// Конструктор по умолчанию, в котором создается пустой контейнер графа. public BAGenerator() { container = new BAContainer(); initialcontainer = new BAContainer(); }
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; } }