예제 #1
0
        public void CalculateConnectivity_should_count_components()
        {
            var graph = Graph(Links(0, 1, 2, 0), Links(3, 4, 5, 3), Links(6, 7));

            Console.WriteLine(graph.ToDOT());

            GraphHelper.CalculateConnectivity(graph)
            .ConnectedComponents.Should().Be(3);
        }
예제 #2
0
        public void CalculateConnectivity_should_correctly_count_bicomponents_in_circle()
        {
            var graph = Graph(Links(0, 1, 2, 3, 4, 0));

            Console.WriteLine(graph.ToDOT());

            var connectivity = GraphHelper.CalculateConnectivity(graph);

            connectivity.ConnectedComponents.Should().Be(1);
            connectivity.BiconnectedComponents.Should().Be(1);
        }
예제 #3
0
        public void CalculateConnectivity_should_correctly_count_bicomponents_in_one_component()
        {
            var graph = Graph(Links(0, 1, 2, 3, 4, 5, 6, 3, 7, 8, 9, 10, 7, 11, 12, 13, 14, 11, 2, 15, 0));

            Console.WriteLine(graph.ToDOT());

            var connectivity = GraphHelper.CalculateConnectivity(graph);

            connectivity.ConnectedComponents.Should().Be(1);
            connectivity.BiconnectedComponents.Should().Be(5);
        }
예제 #4
0
        public void CalculateConnectivity_should_correctly_count_bicomponents_in_small_components()
        {
            var graph = Graph(Links(0, 1, 2, 0), Links(3, 4, 5, 3), Links(6, 7));

            Console.WriteLine(graph.ToDOT());

            var connectivity = GraphHelper.CalculateConnectivity(graph);

            connectivity.ConnectedComponents.Should().Be(3);
            connectivity.BiconnectedComponents.Should().Be(3);
        }