示例#1
0
        public void FindMaximumMatchingTest()
        {
            Graph       g = FileHelper.LoadFile("Resources\\test1.txt");
            List <Edge> M, M1 = new List <Edge>();
            Graph       k = GraphHelper.LineGraph(g, out M);

            k = GraphHelper.ComplementGraph(k);
            M = GraphHelper.FindMaximumMatching(k, M1);
            Assert.AreEqual(M.Count, (int)(k.VerticesCount / 2));
        }
示例#2
0
        public void ComplementGraphTest()
        {
            Graph g = FileHelper.LoadFile("Resources\\test1.txt");
            Graph k = GraphHelper.ComplementGraph(g);

            List <Edge> lst = new List <Edge>();

            for (int i = 0; i < 5; i++)
            {
                foreach (Edge e in k.OutEdges(i))
                {
                    lst.Add(e);
                }
            }
            for (int i = 0; i < 5; i++)
            {
                foreach (Edge e in g.OutEdges(i))
                {
                    Assert.IsFalse(lst.Contains(e));
                }
            }
            Assert.AreEqual(3, k.EdgesCount);
        }