Esempio n. 1
0
            public void TestRandomly()
            {
                var     rg = new RandomGraph(0.3, 4000 /* seed */);
                Graph   graph1, graph2;
                VfState vfs;

                FullMapping[] matches;

                for (var i = 0; i < 10; i++)
                {
                    rg.IsomorphicPair(100, out graph1, out graph2);
                    vfs     = new VfState(graph1, graph2);
                    matches = vfs.Matches().ToArray();
                    Assert.AreNotEqual(0, matches.Length);
                }

                graph1  = rg.GetGraph(100);
                graph2  = rg.GetGraph(100);
                vfs     = new VfState(graph1, graph2);
                matches = vfs.Matches().ToArray();
                Assert.AreEqual(0, matches.Length);

                rg      = new RandomGraph(0.3, 5000 /* seed */);
                graph1  = rg.GetGraph(100);
                rg      = new RandomGraph(0.3, 5000 /* seed */);
                graph2  = rg.GetGraph(100);
                vfs     = new VfState(graph1, graph2);
                matches = vfs.Matches().ToArray();
                Assert.AreEqual(1, matches.Length);
            }
Esempio n. 2
0
            public void TestGetGraph()
            {
                RandomGraph rg = new RandomGraph(0.3);

                Graph graph = rg.GetGraph(30);

                Assert.IsNotNull(graph);
                Assert.AreEqual(30, graph.NodeCount);
            }
            public void TestGetGraph()
            {
                var rg = new RandomGraph(0.3);

                var graph = rg.GetGraph(30);

                Assert.IsNotNull(graph);
                Assert.AreEqual(30, graph.VertexCount);
            }
Esempio n. 4
0
            public void TestRandomlyBig()
            {
                RandomGraph rg = new RandomGraph(0.3, 4000 /* seed */);
                Graph       graph1, graph2;
                VfState     vfs;

                // Vast majority of time spent here looking for 299,000 edges
                // in Isomorphic Pair...
                rg.IsomorphicPair(1000, out graph1, out graph2);

                // The actual match took less than 3 seconds on my machine
                vfs = new VfState(graph1, graph2);
                Assert.IsTrue(vfs.FMatch());
            }
Esempio n. 5
0
            public void TestRandomly()
            {
                RandomGraph rg = new RandomGraph(0.3, 4000 /* seed */);
                Graph       graph1, graph2;
                VfState     vfs;

                for (int i = 0; i < 10; i++)
                {
                    rg.IsomorphicPair(100, out graph1, out graph2);
                    vfs = new VfState(graph1, graph2);
                    Assert.IsTrue(vfs.FMatch());
                }

                graph1 = rg.GetGraph(100);
                graph2 = rg.GetGraph(100);
                vfs    = new VfState(graph1, graph2);
                Assert.IsFalse(vfs.FMatch());
            }
Esempio n. 6
0
            public void TestRandomlyBigPerf()
            {
                RandomGraph rg = new RandomGraph(0.025, 7000 /* seed */);
                Graph       graph1, graph2;
                VfState     vfs;

                rg.IsomorphicPair(4000, out graph1, out graph2);

                //Object objDummy;
                //int iTo = graph2.GetOutEdge(0, 0, out objDummy);
                //graph2.DeleteEdge(0, iTo);

                int totalTicks = 0;
                int cTests     = 20;

                for (int i = 0; i < cTests; i++)
                {
                    vfs = new VfState(graph1, graph2);
                    int starttime = System.Environment.TickCount;
                    vfs.FMatch();
                    totalTicks += System.Environment.TickCount - starttime;
                }
                Console.WriteLine("Total seconds = {0}", totalTicks / (cTests * 1000.0));
            }
Esempio n. 7
0
            public void TestConstructor()
            {
                RandomGraph rg = new RandomGraph(0.2, 20);

                Assert.IsNotNull(rg);
            }