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 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 ClusteringCoefficientTest()
        {
            XMLResultStorage resultStorage = new XMLResultStorage("");
            ResultAssembly goldResult = resultStorage.LoadXML("WSOutput.xml");
            WSContainer container = new WSContainer();
            container.SetMatrix("WSInput.txt");
            AbstarctGraphAnalyzer analyzer = new WSAnalyzer(container);

            SortedDictionary<double, int> actualValue = analyzer.GetClusteringCoefficient();
            SortedDictionary<double, int> expectedValue = goldResult.Results[0].Coefficient;
            Assert.IsTrue(compare(actualValue, expectedValue));
        }
        public void AveragePathTest()
        {
            XMLResultStorage resultStorage = new XMLResultStorage("");
            ResultAssembly goldResult = resultStorage.LoadXML("WSOutput.xml");
            WSContainer container = new WSContainer();
            container.SetMatrix("WSInput.txt");
            AbstarctGraphAnalyzer analyzer = new WSAnalyzer(container);

            double actualValue = analyzer.GetAveragePath();
            double expectedValue = goldResult.Results[0].Result[AnalyseOptions.AveragePath];
            Assert.AreEqual(actualValue, expectedValue);
        }
        private void InitModel()
        {
            log.Info("Started model initialization.");
            InvokeProgressEvent(GraphProgress.Initializing, 0);
            ModelName = MODEL_NAME;

            // Определение параметров генерации. !Добавить число шагов!
            List<GenerationParam> genParams = new List<GenerationParam>();
            genParams.Add(GenerationParam.Vertices);
            genParams.Add(GenerationParam.Edges);
            genParams.Add(GenerationParam.P);
            genParams.Add(GenerationParam.StepCount);
            RequiredGenerationParams = genParams;

            // Определение доступных опций для анализа (вычисляемые характеристики для данной модели (WS)).
            AvailableOptions = AnalyseOptions.AveragePath |
                AnalyseOptions.Diameter |
                AnalyseOptions.Cycles3 |
                AnalyseOptions.Cycles4 |
                AnalyseOptions.EigenValue |
                AnalyseOptions.DegreeDistribution |
                AnalyseOptions.ClusteringCoefficient |
                AnalyseOptions.MinPathDist |
                AnalyseOptions.ConnSubGraph |
                AnalyseOptions.TriangleCountByVertex |
                AnalyseOptions.FullSubGraph;

            // Определение генератора и анализатора для данной модели (WS).
            log.Info("Creating generator and analyzer for model.");
            generator = new WSGenerator();
            analyzer = new WSAnalyzer((WSContainer)generator.Container);

            InvokeProgressEvent(GraphProgress.Ready);
            log.Info("Finished model initialization");
        }
        private void WSModelTest(WSContainer container)
        {
            AbstarctGraphAnalyzer analyzer = new WSAnalyzer(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 order of max full subgraph
            testFullSubgraphs(7, analyzer);
        }
        public void MinPathDistTest()
        {
            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.GetMinPathDist();
            SortedDictionary<int, int> expectedValue = goldResult.Results[0].DistanceBetweenVertices;
            Assert.IsTrue(compare(actualValue, expectedValue));
        }
        public void EigenValueTest()
        {
            XMLResultStorage resultStorage = new XMLResultStorage("");
            ResultAssembly goldResult = resultStorage.LoadXML("WSOutput.xml");
            WSContainer container = new WSContainer();
            container.SetMatrix("WSInput.txt");
            AbstarctGraphAnalyzer analyzer = new WSAnalyzer(container);

            ArrayList actualValue = analyzer.GetEigenValues();
            ArrayList expectedValue = goldResult.Results[0].EigenVector;
            Assert.IsTrue(compare(actualValue, expectedValue));
        }
        public void CyclesTest()
        {
            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, long> actualValue = analyzer.GetCycles(4, 6);
            SortedDictionary<int, long> expectedValue = goldResult.Results[0].Cycles;
            Assert.IsTrue(compare(actualValue, expectedValue));
        }