-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhanced getAdjMatrix function
- Loading branch information
Showing
3 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <benchmark/benchmark.h> | ||
#include "CXXGraph.hpp" | ||
#include "Utilities.hpp" | ||
|
||
static auto nodes = generateRandomNodes(100000, 2); | ||
static auto edges = generateRandomEdges(100000, nodes); | ||
|
||
static void BFS_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.breadth_first_search(*(range_start->second->getNodePair().first)); | ||
} | ||
} | ||
BENCHMARK(BFS_X)->RangeMultiplier(16)->Range((unsigned long)1, (unsigned long)1 << 12); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# BENCHMARK RESULTS | ||
|
||
- To create Json file with results, run: | ||
|
||
```bash | ||
./benchmark --benchmark_out=<filename> --benchmark_out_format=json --benchmark_repetitions=20 | ||
``` | ||
|
||
- To compare results, run: | ||
|
||
```bash | ||
./compare.py benchmarks /workspaces/CXXGraph/benchmark/results/file1.json /workspaces/CXXGraph/benchmark/results/file2.json | ||
``` | ||
|
||
BFS_X/256_mean 2376804 ns 2370768 ns 20 | ||
BFS_X/16_mean 14632 ns 14623 ns 20 | ||
BFS_X/1_mean 1504 ns 1503 ns 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters