void benchmark_ts_PLP(tsppi::TsPpiGraph& tsppi, bool printHist=false) { CPUTimer timer; double naive_time, fast_time; LOG("Start Benchmark: Naive"); timer.start(); std::vector<NetworKit::Partition > partitions = tsppi::algo::subgraph_PLP(tsppi.subgraphs); timer.stop(); naive_time = timer.getTime(); LOG("Time for Naive: " << timer.getTime() << " s"); LOG("Start Benchmark: Fast"); timer.start(); std::vector<NetworKit::Partition > partitions_2 = tsppi::algo::subgraph_PLP_vec(tsppi.subgraphs); timer.stop(); fast_time = timer.getTime(); LOG("Time for Fast: " << timer.getTime() << " s"); // print histogram if (printHist) { std::cout << "Histogram of cluster sizes for Naive:" << std::endl; clusterSizeHist(partitions); std::cout << "Histogram of cluster sizes for fast:" << std::endl; clusterSizeHist(partitions_2); } // print timings std::cout << naive_time << ";" << fast_time; }
void benchmark_ts_clustercoeff(tsppi::TsPpiGraph& tsppi) { CPUTimer timer; double naive_time, fast_time, faster_time; LOG("Start Benchmark: Naive"); timer.start(); std::vector<std::vector<double> > naive_ts_bw = tsppi::algo::subgraph_cc(tsppi.subgraphs); timer.stop(); naive_time = timer.getTime(); LOG("Time for Naive: " << timer.getTime() << " s"); LOG("Start Benchmark: Fast"); timer.start(); std::vector<std::vector<double> > fast_ts_bw = tsppi::algo::subgraph_cc_neighbor_comb(tsppi.subgraphs); timer.stop(); fast_time = timer.getTime(); LOG("Time for Fast: " << timer.getTime() << " s"); LOG("Start Benchmark: Fast"); timer.start(); std::vector<std::vector<double> > faster_ts_bw = tsppi::algo::subgraph_cc_neighbor_comb_vec(tsppi.subgraphs); timer.stop(); faster_time = timer.getTime(); LOG("Time for Fast: " << timer.getTime() << " s"); std::cout << naive_time << ";" << fast_time << ";" << faster_time; }
void benchmark_ts_betweenness(tsppi::TsPpiGraph& tsppi) { CPUTimer timer; double naive_time, fast_time; LOG("Start Benchmark: Naive"); timer.start(); std::vector<std::vector<double> > naive_ts_bw = tsppi::algo::subgraph_betweenness(tsppi.subgraphs); timer.stop(); naive_time = timer.getTime(); LOG("Time for Naive: " << timer.getTime() << " s"); LOG("Start Benchmark: Fast"); timer.start(); std::vector<std::vector<double> > fast_ts_bw = tsppi::algo::subgraph_betweenness_fast(tsppi.subgraphs); timer.stop(); fast_time = timer.getTime(); LOG("Time for Fast: " << timer.getTime() << " s"); std::cout << naive_time << ";" << fast_time; }