示例#1
0
            public void FourArgs()
            {
                var g = new GraphChromosome(VertTemplate, EdgeTemplate, Verts, Edges);

                Assert.AreEqual(VertTemplate, g.VertexTemplate);
                Assert.AreEqual(EdgeTemplate, g.EdgeTemplate);
                Assert.AreEqual(1, g.VertexCount);
                Assert.AreEqual(1, g.EdgeCount);
                Assert.IsTrue(g.ContainsVertex(0));
                Assert.IsTrue(g.ContainsEdge(0, 0));
            }
        public void Mutate()
        {
            var factory = new IDFactory(3u);
            var mut     = new SplitEdgeMutation(factory);

            mut.Mutate(Graph, 0);
            Assert.AreEqual(2, Graph.VertexCount);
            Assert.AreEqual(1, Graph.EdgeCount);
            mut.Mutate(Graph, 1);
            Assert.AreEqual(3, Graph.VertexCount);
            Assert.IsTrue(Graph.ContainsVertex(3u));
            Assert.AreEqual(2, Graph.EdgeCount);
            Assert.IsTrue(Graph.ContainsEdge(0u, 3u));
            Assert.IsTrue(Graph.ContainsEdge(3u, 1u));
            Assert.IsFalse(Graph.ContainsEdge(0u, 1u));
        }