public void GraphIsomorphismConnnected(int n, int repetitions, double density, int generatingSeed, int permutingSeed) { for (int i = 1; i < n; i += 1) { var max = repetitions; if (i == 2) { max = 1; } for (int j = 0; j < max; j += 1) { // randomize a graph of given n and density var g = GraphFactory.GenerateRandom(i, density, generatingSeed + j * j); var h = GraphFactory.GeneratePermuted(g, permutingSeed - j); // run the algorithm SubgraphIsomorphismExactAlgorithm.ParallelSubgraphIsomorphismExtractor.ExtractOptimalSubgraph( g, h, (vertices, edges) => vertices, out var score, out var subgraphEdges, out var gToH, out var hToG, false, false ); Assert.NotEmpty(gToH); Assert.NotEmpty(hToG); // verify the solution var maximumConnectedComponentSize = g.ExtractAllConnectedComponents().Max(cc => cc.Count); Assert.Equal(maximumConnectedComponentSize, gToH.Count); Assert.Equal(maximumConnectedComponentSize, hToG.Count); AreTransitionsCorrect(gToH, hToG); HasSubgraphCorrectIsomorphism(g, h, gToH, hToG); } } }