예제 #1
0
        public void SomeNewAlgorithmsTest()
        {
            var graph      = new Graph(1);
            var algorithm  = GraphAlgorithmFactory.ResolveGraphAlgorithm(GraphAlgorithmsRegistry.ExampleAlgorithm);
            var parameters = new GraphAlgorithmParameters(graph, edges: new Edge[] { });

            algorithm.PerformAlgorithmAsync(parameters);
            algorithm.AlgorithmPerformed += OnAlgorithmPerformed;
        }
예제 #2
0
        public void ConnectedComponentsCountTest()
        {
            var graph      = new Graph(3);
            var algorithm  = GraphAlgorithmFactory.ResolveGraphAlgorithm(GraphAlgorithmsRegistry.ConnectedComponentsCount);
            var parameters = new GraphAlgorithmParameters(graph);

            algorithm.PerformAlgorithmAsync(parameters);

            while (algorithm.IsPerforming)
            {
                Thread.Sleep(10);
            }

            algorithm.Result.Number.Should().Be(3);
        }