Added time
This commit is contained in:
parent
c1eb1f1127
commit
bed5fb8f22
17
src/main.cpp
17
src/main.cpp
@ -1,5 +1,7 @@
|
||||
#include "algorithm.hpp"
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
@ -9,16 +11,27 @@ int main(int argc, char* argv[]) {
|
||||
Graph newGraph = ReadInGraph(argv[1]);
|
||||
std::cout << "BFS" << std::endl;
|
||||
std::cout << "---" << std::endl;
|
||||
for (int i = 1; i < newGraph.nodeCount + 1; i++) {
|
||||
auto t_start = std::chrono::high_resolution_clock::now();
|
||||
PrintSolution(BFS(newGraph, 1, 1));
|
||||
auto t_end = std::chrono::high_resolution_clock::now();
|
||||
for (int i = 2; i < newGraph.nodeCount + 1; i++) {
|
||||
PrintSolution(BFS(newGraph, 1, i));
|
||||
}
|
||||
std::cout << "BFS Time: " << std::chrono::duration<double, std::milli>(t_end-t_start).count() << std::endl;
|
||||
std::cout << "DFS" << std::endl;
|
||||
std::cout << "---" << std::endl;
|
||||
for (int i = 1; i < newGraph.nodeCount + 1; i++) {
|
||||
t_start = std::chrono::high_resolution_clock::now();
|
||||
PrintSolution(DFS(newGraph, 1, 1));
|
||||
t_end = std::chrono::high_resolution_clock::now();
|
||||
for (int i = 2; i < newGraph.nodeCount + 1; i++) {
|
||||
PrintSolution(DFS(newGraph, 1, i));
|
||||
}
|
||||
std::cout << "DFS Time: " << std::chrono::duration<double, std::milli>(t_end-t_start).count() << std::endl;
|
||||
std::cout << "UCBFS" << std::endl;
|
||||
std::cout << "---" << std::endl;
|
||||
t_start = std::chrono::high_resolution_clock::now();
|
||||
UCBFS(newGraph, 1);
|
||||
t_end = std::chrono::high_resolution_clock::now();
|
||||
std::cout << "UCBFS Time: " << std::chrono::duration<double, std::milli>(t_end-t_start).count() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user