forked from ZigRazor/CXXGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDFS_BM.cpp
More file actions
37 lines (31 loc) · 1006 Bytes
/
Copy pathDFS_BM.cpp
File metadata and controls
37 lines (31 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <benchmark/benchmark.h>
#include <unordered_map>
#include "CXXGraph/CXXGraph.hpp"
#include "Utilities.hpp"
static void DFS_X(benchmark::State &state) {
CXXGraph::Graph<int> g;
auto range_start = edges.begin();
auto range_end = edges.find(state.range(0));
std::unordered_map<unsigned long, CXXGraph::Edge<int> *> edgesX;
edgesX.insert(range_start, range_end);
for (auto e : edgesX) {
g.addEdge(&(*e.second));
}
for (auto _ : state) {
auto &result =
g.depth_first_search(*(range_start->second->getNodePair().first));
}
state.SetComplexityN(state.range(0));
}
BENCHMARK(DFS_X)
->RangeMultiplier(2)
->Range((unsigned long)1, (unsigned long)1 << 18)
->Complexity();
static void DFS_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
for (auto _ : state) {
auto &result = cit_graph_ptr->depth_first_search(
*((*(edgeSet.begin()))->getNodePair().first));
}
}
// BENCHMARK(DFS_FromReadedCitHep);