void timeTC(graph<intT> G, int rounds, char* outFile) { graph<intT> GN = G.copy(); intT ans; ans = countTriangle(GN); for (int i=0; i < rounds; i++) { GN.del(); GN = G.copy(); startTime(); ans = countTriangle(GN); nextTimeN(); } cout << endl; G.del(); if (outFile != NULL) writeAnswer(ans, outFile); GN.del(); }
void timeBFS(graph<intT> G, int rounds, char* outFile) { graph<intT> GN = G.copy(); BFS(0, GN); for (int i=0; i < rounds; i++) { GN.del(); GN = G.copy(); //startTime(); BFS(0, GN); //nextTimeN(); } //cout << endl; // G.del(); // LINE REMOVED intT m = 0; for (intT i=0; i < GN.n; i++) m += GN.V[i].degree; GN.m = m; if (outFile != NULL) writeGraphToFile(GN, outFile); GN.del(); }
void timeMIS(graph<intT> G, int rounds, char* outFile) { graph<intT> H = G.copy(); //because MIS might modify graph char* flags = maximalIndependentSet(H); for (int i=0; i < rounds; i++) { free(flags); H.del(); H = G.copy(); startTime(); flags = maximalIndependentSet(H); nextTimeN(); } cout << endl; if (outFile != NULL) { int* F = newA(int, G.n); for (int i=0; i < G.n; i++) F[i] = flags[i]; writeIntArrayToFile(F, G.n, outFile); free(F); }