Exemplo n.º 1
0
        public void TestVertexCountAndTrim()
        {
            var graph = new DirectedMetaGraph(1, 1, 10);

            // add edge.
            graph.AddEdge(0, 1, 1, 100);

            // trim.
            graph.Trim();
            Assert.AreEqual(2, graph.VertexCount);

            graph = new DirectedMetaGraph(1, 1, 10);

            // add edge.
            graph.AddEdge(0, 1, 1, 100);
            graph.AddEdge(0, 11001, 1, 100);

            // trim.
            graph.Trim();
            Assert.AreEqual(11002, graph.VertexCount);

            graph = new DirectedMetaGraph(1, 1, 10);

            // trim.
            graph.Trim(); // keep minimum one vertex.
            Assert.AreEqual(1, graph.VertexCount);
        }