After the recursive call, you must again insert the edges that you deleted before, and get rid of the gap.
void DFS(Graph &G, int x) { int i; Push(x); for (i = 0; i < v; i++) if (G[i][x] > 0) { G[i][x] *= -1; G[x][i] *= -1; DFS(G, i); G[i][x] *= -1; G[x][i] *= -1; } }
Now you need to find out when you created the complete cycle to print it and move on to the next. This happens when you eliminate every edge of your schedule.
Ivlad source share