1 #ifndef BFS_BENCHMARK_H 2 #define BFS_BENCHMARK_H 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;
92 time.push_back ((
double)elapsed_seconds.count() );
93 vtxCounts.push_back ( (
double)vertexCount );
94 edgeCounts.push_back ( (
double)edgeCount );
96 if (elapsed_seconds.count() > time_cap) {
100 plot.
setXData(algoName, edgeCounts);
102 std::cerr <<
"\n" << std::flush;
BFSBenchmark(LineChart &p)
Definition: BFSBenchmark.h:48
void setXLabel(string xaxisName)
Change the label for the X-axis.
Definition: LineChart.h:184
This class provides methods to represent adjacency list based graphs.
Definition: Element.h:19
Show series of data or functions using a line chart.
Definition: LineChart.h:43
void setXData(string series, vector< double > xdata)
Changes the X data for a series.
Definition: LineChart.h:217
Base class for a variety of graph based benchmark.
Definition: GraphBenchmark.h:15
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
Definition: alltypes.h:4
Benchmarks Breadth First Search algorithms.
Definition: BFSBenchmark.h:43
void setYData(string series, vector< double > ydata)
Changes the Y data for a series.
Definition: LineChart.h:237
void setYLabel(string yaxisName)
Change the label for the Y-axis.
Definition: LineChart.h:166
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