本文整理汇总了C++中graph::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ graph::copy方法的具体用法?C++ graph::copy怎么用?C++ graph::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timeTC
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();
}
示例2: timeBFS
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();
}
示例3: timeMIS
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);
}