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 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);
        }
 // Конструктор по умолчанию, в котором создается пустой контейнер графа.
 public WSGenerator()
 {
     container = new WSContainer();
 }
 // Конструктор, получающий контейнер графа.
 public WSAnalyzer(WSContainer c)
 {
     log.Info("Creating WSAnalizer object.");
     container = c;
     CountNeighbourships();
 }
        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);
        }
        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 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));
        }