예제 #1
0
            public void TestAutomorphic()
            {
                int   cRows = 10, cCols = 10;
                Graph graph1 = new Graph();

                graph1.InsertNodes(cRows * cCols);
                for (int iRow = 0; iRow < cRows - 1; iRow++)
                {
                    for (int iCol = 0; iCol < cCols - 1; iCol++)
                    {
                        int iNode      = iCol * cRows + iRow;
                        int iNodeToCol = iNode + 1;
                        int iNodeToRow = iNode + cRows;

                        graph1.InsertEdge(iNode, iNodeToCol);
                        graph1.InsertEdge(iNode, iNodeToRow);
                        graph1.InsertEdge(iNodeToCol, iNode);
                        graph1.InsertEdge(iNodeToRow, iNode);
                    }
                }
                Graph graph2 = graph1.IsomorphicShuffling(new Random(102));
                // Insert this and you'll wait a LONG time for this test to finish...
                // Note - the above is no longer true now that we have Degree compatibility check
                // graph1.InsertEdge(0, cRows * cCols - 1);

                VfState vfs = new VfState(graph1, graph2, true);

                Assert.IsTrue(vfs.FMatch());
            }
예제 #2
0
            public void TestAutomorphic()
            {
                const int cRows  = 10;
                const int cCols  = 10;
                var       graph1 = new Graph();

                graph1.InsertVertices(cRows * cCols);
                for (var iRow = 0; iRow < cRows - 1; iRow++)
                {
                    for (var iCol = 0; iCol < cCols - 1; iCol++)
                    {
                        var ivtx         = iCol * cRows + iRow;
                        var iVertexToCol = ivtx + 1;
                        var iVertexToRow = ivtx + cRows;

                        graph1.AddEdge(ivtx, iVertexToCol);
                        graph1.AddEdge(ivtx, iVertexToRow);
                        graph1.AddEdge(iVertexToCol, ivtx);
                        graph1.AddEdge(iVertexToRow, ivtx);
                    }
                }
                var graph2 = graph1.IsomorphicShuffling(new Random(102));
                // Insert this and you'll wait a LONG time for this test to finish...
                // Note - the above is no longer true now that we have Degree compatibility check
                // graph1.AddEdge(0, cRows * cCols - 1);

                var vfs     = new VfState(graph1, graph2, true);
                var matches = vfs.Matches().ToArray();

                Assert.AreNotEqual(0, matches.Length);
            }
예제 #3
0
 public void IsomorphicPair(int cnod, out Graph graph1, out Graph graph2)
 {
     graph1 = GetGraph(cnod);
     graph2 = graph1.IsomorphicShuffling(_rnd);
 }