Пример #1
0
            public void TestMatch()
            {
                var gr1 = new Graph();
                var gr2 = new Graph();

                var vfs   = new VfState(gr1, gr2);
                var match = vfs.Match();

                Assert.IsNotNull(match);                                        // Two empty graphs match
                gr2.InsertVertex();
                vfs   = new VfState(gr1, gr2);
                match = vfs.Match();
                Assert.IsNull(match);                                           // Graph with no vertices will not match one with a single isolated vertex
                gr1.InsertVertex();
                vfs   = new VfState(gr1, gr2);
                match = vfs.Match();
                Assert.IsNotNull(match);                                        // Two graphs with single isolated vertices match
                gr1.InsertVertex();
                vfs   = new VfState(gr1, gr2);
                match = vfs.Match();
                Assert.IsNotNull(match);                                        // Two isolated vertices match with one under default subgraph isomorphism
                gr1.AddEdge(0, 1);
                vfs   = new VfState(gr1, gr2);
                match = vfs.Match();
                Assert.IsNotNull(match);                                        // Connect the two and a subgraph isomorphism still works
            }