diff --git a/src/main.cpp b/src/main.cpp index 02ed746..9bb2081 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,7 @@ #include "algorithm.hpp" +#include #include +#include 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(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(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(t_end-t_start).count() << std::endl; return 0; }