Esempio n. 1
0
        public void NamedGraphTest()
        {
            var importer = new NamedExcelImporter <AdjacencyListGraph>();

            var graphs = importer.GetGraphs(Filename("named-graph"));

            Assert.That(graphs.Count, Is.EqualTo(2));

            var graph1 = graphs[0];

            Assert.That(graph1.Name, Is.EqualTo("Graph1"));
            Assert.That(graph1["Hello"], Is.EqualTo(0));
            Assert.That(graph1["world"], Is.EqualTo(1));
            Assert.That(graph1.HasArrow("Hello", "world"));

            var graph2 = graphs[1];

            Assert.That(graph2.Name, Is.EqualTo("Graph2"));
            Assert.That(graph2["John"], Is.EqualTo(0));
            Assert.That(graph2["Jack"], Is.EqualTo(1));
            Assert.That(graph2["Jane"], Is.EqualTo(2));
            Assert.That(graph2.HasArrow("John", "Jane"));
            Assert.That(graph2.HasArrow("Jane", "Jack"));
            Assert.That(graph2.HasArrow("Jack", "John"));
        }
Esempio n. 2
0
        private void LoadingWorkerOnDoWork(object sender, DoWorkEventArgs doWorkEventArgs)
        {
            var fileName = doWorkEventArgs.Argument as string;
            var graph    = new NamedExcelImporter <AdjacencyGraph>().GetGraphs(fileName)[0];

            doWorkEventArgs.Result = graph;
        }
        public void PerformanceTest()
        {
            var fileNmae = $"{AppDomain.CurrentDomain.BaseDirectory}\\TestSamples\\муниципалитет.xlsx";
            var graph    = new NamedExcelImporter <AdjacencyGraph>().GetGraphs(fileNmae)[0];
            var timer    = new Stopwatch();

            timer.Start();
            var result = graph.FindCycles();

            timer.Stop();

            Console.WriteLine($"Elapsed time: {timer.Elapsed}");
            Console.WriteLine($"Total cycles: {result.Count}");
        }