public void TwoCliquesConnectedByChain(int max)
        {
            for (int i = 4; i < max; i += 1)
            {
                for (int j = 3; j <= i; j += 1)
                {
                    var g = GraphFactory.GenerateCliquesConnectedByChain(i, j, 5).Permute(02);
                    var h = GraphFactory.GenerateCliquesConnectedByChain(i, j, 4).Permute(12);

                    // verify result

                    SubgraphIsomorphismExactAlgorithm.ParallelSubgraphIsomorphismExtractor.ExtractOptimalSubgraph(
                        g,
                        h,
                        (vertices, edges) => vertices + edges,
                        out var score,
                        out var subgraphEdges,
                        out var gToH,
                        out var hToG,
                        true,
                        false
                        );

                    Assert.NotEmpty(gToH);
                    Assert.NotEmpty(hToG);
                    // verify the solution
                    Assert.Equal((i * (i - 1) / 2 + j * (j - 1) / 2 + 2) + (i + j + 2), score);
                    Assert.Equal(i * (i - 1) / 2 + j * (j - 1) / 2 + 2, subgraphEdges);
                    Assert.Equal(i + j + 2, gToH.Count);
                    Assert.Equal(i + j + 2, hToG.Count);

                    AreTransitionsCorrect(gToH, hToG);
                    HasSubgraphCorrectIsomorphism(g, h, gToH, hToG);
                }
            }
        }
예제 #2
0
 private static void GenerateCliquesConnectedByChain(int i, int j, out Graph g, out Graph h)
 {
     g = GraphFactory.GenerateCliquesConnectedByChain(i, j, 5);
     h = GraphFactory.GenerateCliquesConnectedByChain(i, j, 4);
     Export("Cliques_Connected_By_Chain", g, h);
 }