public void TestMediumGraph()
        {
            IGraph <int> graph      = ReadGraphFromFile("./graphs/Graph3.txt");
            int          components = ConnectedComponents.Count(graph);

            Assert.AreEqual(4, components);
        }
        public void TestHugeGraph()
        {
            IGraph <int> graph      = ReadGraphFromFile("./graphs/Graph_ganzganzgross.txt");
            int          components = ConnectedComponents.Count(graph);

            Assert.AreEqual(306, components);
        }
        public void ConnectedComponents_Test()
        {
            ConnectedComponents CC = new ConnectedComponents(basicGraph);

            Assert.AreEqual(2, CC.Count());
            Assert.AreEqual(0, CC.ID(0));
            Assert.AreEqual(1, CC.ID(8));
        }
Exemple #4
0
        public void ConnectedComponentsWhenEveryVertexIsolated()
        {
            WeightedGraph <int> graph = new WeightedGraph <int>
            {
                new WeightedEdge <int>(1, 1),
                new WeightedEdge <int>(2, 2),
                new WeightedEdge <int>(3, 3)
            };

            ConnectedComponents <int> cc = new ConnectedComponents <int>(graph);

            Assert.AreEqual(3, cc.Count());
        }