1 #ifndef BFS_BENCHMARK_H
2 #define BFS_BENCHMARK_H
50 p.setXLabel(
"Number of Edges");
51 p.setYLabel(
"Runtime (in s)");
61 void run(std::string algoName,
64 std::unordered_map<std::string, int>& level,
65 std::unordered_map<std::string, std::string>& parent)) {
66 std::vector<double> time;
67 std::vector<double> vtxCounts;
68 std::vector<double> edgeCounts;
70 for (
int years = 0; years < 120; years = 1.2 * years + 1) {
71 int year = 2019 - years;
72 std::cerr <<
"*" << std::flush;
76 std::tie(vertexCount, edgeCount) = generateWikidataMovieActor(year, 2019, graph);
78 std::string root = highestDegreeVertex(graph);
80 std::unordered_map<std::string, int> level;
81 std::unordered_map<std::string, std::string> parent;
83 std::chrono::time_point<std::chrono::system_clock> start = std::chrono::system_clock::now();
85 bfsalgo(graph, root, level, parent);
87 std::chrono::time_point<std::chrono::system_clock> end = std::chrono::system_clock::now();
89 std::chrono::duration<double> elapsed_seconds = end - start;
91 time.push_back ((
double)elapsed_seconds.count() );
92 vtxCounts.push_back ( (
double)vertexCount );
93 edgeCounts.push_back ( (
double)edgeCount );
95 if (elapsed_seconds.count() > time_cap) {
101 std::cerr <<
"\n" << std::flush;
Benchmarks Breadth First Search algorithms.
Definition: BFSBenchmark.h:43
void run(std::string algoName, void(*bfsalgo)(const GraphAdjList< std::string > &gr, std::string root, std::unordered_map< std::string, int > &level, std::unordered_map< std::string, std::string > &parent))
benchmark one implementation
Definition: BFSBenchmark.h:61
BFSBenchmark(LineChart &p)
Definition: BFSBenchmark.h:48
Base class for a variety of graph based benchmark.
Definition: GraphBenchmark.h:15
This class provides methods to represent adjacency list based graphs.
Definition: GraphAdjList.h:110
Show series of data or functions using a line chart.
Definition: LineChart.h:43
void setYData(string series, vector< double > ydata)
Changes the Y data for a series.
Definition: LineChart.h:234
void setXData(string series, vector< double > xdata)
Changes the X data for a series.
Definition: LineChart.h:214
Support for drawing Bar charts.
Definition: alltypes.h:4