Ejemplo n.º 1
0
        public void ContractGraph_Graph2_test1()
        {
            var g       = GetGraph2();
            var blossom = new List <Edge <int> >
            {
                new Edge <int>(1, 2),
                new Edge <int>(2, 4),
                new Edge <int>(1, 4),
            };
            var matching = new List <Edge <int> >
            {
                new Edge <int>(4, 1),
                new Edge <int>(0, 3),
            };

            var contractedGraph = EdmondsAlgorithm.ContractGraph(g, blossom, out int superVertex, matching);

            Assert.IsFalse(IsSuperVertexMatched(superVertex, matching));

            Assert.IsTrue(IsContractedGraphCorrect(contractedGraph, blossom, superVertex));
        }
Ejemplo n.º 2
0
        public void ContractGraph_Graph1()
        {
            var g       = GetGraph1();
            var blossom = new List <Edge <int> >
            {
                new Edge <int>(0, 4),
                new Edge <int>(0, 1),
                new Edge <int>(1, 4),
            };
            var matching = new List <Edge <int> >
            {
                new Edge <int>(4, 1),
                new Edge <int>(2, 3),
            };

            var contractedGraph = EdmondsAlgorithm.ContractGraph(g, blossom, out int superVertex, matching);

            Assert.IsFalse(IsSuperVertexMatched(superVertex, matching));

            Assert.AreEqual(contractedGraph.EdgeCount, g.EdgeCount - blossom.Count);
        }