public static void Test_3(input_test_3 A1, out output_test_3 B1) { int number_of_nodes; B1 = new output_test_3(A1.number_of_increasments); Stopwatch S = new Stopwatch(); S.Start(); Random r = new Random(); int i1, i2; for (i1 = 0; i1 < A1.number_of_increasments; i1++) { number_of_nodes = A1.starting_number_of_nodes + A1.incresement_of_nodes * i1; B1.number_of_nodes[i1] = number_of_nodes; for (i2 = 0; i2 < A1.repeatings_for_each_case; i2++) { bool[,] F_1_Adjancy_Matrix = Class2.Create_Random_Adjancy_Matrix(number_of_nodes, r); bool[,] F_2_Adjancy_Matrix; if (A1.are_isomorphic) { F_2_Adjancy_Matrix = Class2.Permute(F_1_Adjancy_Matrix, r); } else { F_2_Adjancy_Matrix = Class2.Create_Random_Adjancy_Matrix(number_of_nodes, r); } S.Restart(); bool result = Graph_Functions.Graph_Isomorphism(Graph_Functions.To_Adjency_Lists_From_Adjency_Matrix(F_1_Adjancy_Matrix), Graph_Functions.To_Adjency_Lists_From_Adjency_Matrix(F_2_Adjancy_Matrix)); long time = S.ElapsedMilliseconds; B1.average_times[i1] += (double)time; } B1.average_times[i1] /= A1.repeatings_for_each_case; } }
public static void Test_Graph_Key_Dictionary() { Random rand = new Random(); GraphFunctions.Graph_Key_Dictionary <int> A = new GraphFunctions.Graph_Key_Dictionary <int>(); bool[,] b1 = Class2.Create_Random_Adjancy_Matrix(100, rand); A.Add(b1, 1); Console.WriteLine("Test_Graph_Key_Dictionary Result: " + A.ContainsKey(b1)); }
public static void Test_6() { Random r = new Random(); bool[,] z = Class2.Create_Random_Adjancy_Matrix(100, r); int[] b1 = Graph_Functions.Transform_Bool_Matrix_To_Int_Array(z); bool[,] v1 = Graph_Functions.Transform_Int_Array_To_Bool_Matrix(b1); Console.WriteLine("Test_6 Result:" + Graph_Functions.Are_Identical_Matrixes(z, v1)); }
public static bool[,] F1(int n1, int n2) { Random r = new Random(); int n3 = n1 * n2; bool[,] q1 = new bool[n3, n3]; bool[,] q2 = Class2.Create_Random_Adjancy_Matrix(n2, r); bool[,] q3 = Class2.Create_Random_Adjancy_Matrix(n2, r); bool[,] q4 = Class2.Create_Random_Adjancy_Matrix(n2, r); for (int i1 = 0; i1 < n1; i1++) { F2(i1 * n2, i1 * n2, q1, q2); F2(i1 * n2, ((i1 * n2) + 1) % n1, q1, q3); F2(((i1 * n2) + 1) % n1, i1 * n2, q1, q4); } return(q1); }
public static void Test_2_NOT_isomorphic_samples(int n) { Random r = new Random(); Stopwatch t1 = new Stopwatch(); bool[,] F_1_Adjancy_Matrix = Class2.Create_Random_Adjancy_Matrix(n, r); bool[,] F_2_Adjancy_Matrix = Class2.Create_Random_Adjancy_Matrix(n, r); t1.Start(); bool is_isomorphic = Graph_Functions.Graph_Isomorphism(Graph_Functions.To_Adjency_Lists_From_Adjency_Matrix(F_1_Adjancy_Matrix), Graph_Functions.To_Adjency_Lists_From_Adjency_Matrix(F_2_Adjancy_Matrix)); long time = t1.ElapsedMilliseconds; Console.WriteLine( "\n\nNot isomorphic samples" + "\nnumber of nodes:" + n.ToString().PadLeft(10) + "\ntime in miliseconds:" + time.ToString().PadLeft(10)); Console.WriteLine("/// " + !is_isomorphic); }
public static void Test_4() { Random r = new Random(); int n1 = 100; bool[,] Z1 = Class2.Create_Random_Adjancy_Matrix(n1, r); bool[,] a1; bool[,] a2; bool[,] b1; bool[,] b2; bool c1; a1 = Class2.Permute(Z1, r); a2 = Class2.Permute(Z1, r); b1 = Graph_Functions.Transform_From_Any_Isomorphism_To_Single_Same_Isomorphism(a1); b2 = Graph_Functions.Transform_From_Any_Isomorphism_To_Single_Same_Isomorphism(a2); c1 = Compare_Matrices(b1, b2); Console.WriteLine("Test_4 Rasult:" + c1); }
public static void Test_5() { Random r = new Random(); GraphFunctions.Mark_Graph g1 = new GraphFunctions.Mark_Graph(); int n1 = 100; int t1, t2; bool[,] Z1; bool[,] a1; bool[,] a2; bool c1; Z1 = Class2.Create_Random_Adjancy_Matrix(n1, r); a1 = Class2.Permute(Z1, r); a2 = Class2.Permute(Z1, r); t1 = g1.Insert(a1); t2 = g1.Insert(a2); c1 = t1 == t2; Console.WriteLine("Test_5 Rasult:" + c1); }