I just want to know, if there is an infinite loop in the checkIso function, or it just takes that much time to compute.
// permutation of rows
void permRows(vector<vector<int>> &adjMatr, int row1Ind, int row2Ind) {
vector<int> temp(adjMatr.size(), 0);
for (int i = 0; i < adjMatr.size(); i++) {
temp[i] = adjMatr[row1Ind][i];
}
adjMatr[row1Ind] = adjMatr[row2Ind];
adjMatr[row2Ind] = temp;
}
// permutation of columns
void permColumns(vector<vector<int>> &adjMatr, int col1Ind, int col2Ind) {
vector<int> temp(adjMatr.size(), 0);
for (int i = 0; i < adjMatr.size(); i++) {
temp[i] = adjMatr[i][col1Ind];
}
for (auto & i : adjMatr) {
i[col1Ind] = i[col2Ind];
}
for (int i = 0; i < adjMatr.size(); i++) {
adjMatr[i][col2Ind] = temp[i];
}
}
bool res = false;
// NEEDED FUNCTION
void checkIso(vector<vector<int>> adjMatr, const vector<vector<int>>& adjMatrTest, long long k) {
if (k >= adjMatr.size()) return;
for (int i = 0; i < adjMatr.size(); i++) {
for (int j = i; j < adjMatr.size(); j++) {
std::vector<std::vector<int>> tempMatr = adjMatr; // Create a temporary copy of the matrix for each thread
permRows(tempMatr, i, j);
permColumns(tempMatr, i, j);
if (compMatr(tempMatr, adjMatrTest)) {
{
res = true;
}
}
checkIso(tempMatr, adjMatrTest, k + 1);
}
}
}
That function is intended to determine, whether two graphs are isomorphic, so it may take long time, but I suggest it may also cause an infinite cycle, because I have been waiting for a value for n = 6 too much.
Don’t really know what to do in such case.