Skip to content

Commit

Permalink
:octocat: Applied clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
pratzl authored and github-actions[bot] committed Aug 15, 2024
1 parent 046ccb4 commit 55b0771
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
3 changes: 2 additions & 1 deletion benchmark/mm_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ bench_files g2bench_chesapeake(g2bench, "", "chesapeake.mtx", "chesapeake.sorted
bench_files g2bench_bips98_606(g2bench, "", "bips98_606.mtx", "bips98_606.sorted.mtx", "sources.mtx");
// sources.mtx is a generic set of sources that can be used with either g2bench graph

vector<bench_files> datasets = {gap_road, gap_twitter, gap_web, gap_kron, gap_urand, g2bench_chesapeake, g2bench_bips98_606};
vector<bench_files> datasets = {gap_road, gap_twitter, gap_web, gap_kron,
gap_urand, g2bench_chesapeake, g2bench_bips98_606};
2 changes: 1 addition & 1 deletion benchmark/mm_load_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void mm_load_file_example() {
// Load a simple graph: vector<vector<tuple<int64_t, int64_t>>>
{
vector<vector<tuple<int64_t, int64_t>>> g;
graph_stats stats = load_graph(triplet, g);
graph_stats stats = load_graph(triplet, g);
fmt::println("Graph stats: {}", stats);
}

Expand Down
14 changes: 7 additions & 7 deletions benchmark/nwgraph_dijkstra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
// from nwgraph with minor refactoring to use graph-v2
template <adjacency_list Graph, class Weight, class Sources>
static auto nwgraph_dijkstra(
Graph&& graph, const Sources& sources, Weight weight = [](auto& e) -> auto& {
return std::get<1>(e);
}) {
Graph&& graph, const Sources& sources, Weight weight = [](auto& e) -> auto& { return std::get<1>(e); }) {
using namespace std::graph;
using vertex_id_type = vertex_id_t<Graph>;

Expand All @@ -17,13 +15,15 @@ static auto nwgraph_dijkstra(
//queue_t mq;
//auto mq = nw::graph::make_priority_queue<vertex_id_type>(
// [&dist](const vertex_id_type& a, vertex_id_type& b) { return dist[a] > dist[b]; });
auto compare = [&dist](vertex_id_type& a, vertex_id_type& b) { return dist[static_cast<size_t>(a)] > dist[static_cast<size_t>(b)]; };
using queue_t = std::priority_queue<vertex_id_type, std::vector<vertex_id_type>, decltype(compare)>;
auto compare = [&dist](vertex_id_type& a, vertex_id_type& b) {
return dist[static_cast<size_t>(a)] > dist[static_cast<size_t>(b)];
};
using queue_t = std::priority_queue<vertex_id_type, std::vector<vertex_id_type>, decltype(compare)>;
queue_t mq(compare);

for (auto&& source : sources) {
mq.push(source);
dist[static_cast<size_t>(source)] = 0;
mq.push(source);
dist[static_cast<size_t>(source)] = 0;
}

#if defined(ENABLE_POP_COUNT) || defined(ENABLE_EDGE_VISITED_COUNT)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using std::endl;

double simple_timer::elapsed() const {
return std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - start_time_)
.count();
.count();
}

timer::timer(const std::string& name, bool include_start) : name_(name), _include_start(include_start) {
Expand Down
4 changes: 2 additions & 2 deletions include/graph/algorithm/experimental/visitor_dijkstra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void dijkstra_with_visitor(
// queue, they can copy the implementation and use their own queue type.
// Allowing the caller to defined the queue also exposes the internals of the algorithm
// and requires that the caller support the same semantics, making it more complex.
//
//
//Que que = _dijkstra_queue<G, Distances>(_dijkstra_distance_compare(g, distances), vector<vertex_id_t<G>>());

auto qcompare = [&distances](id_type a, id_type b) {
Expand Down Expand Up @@ -264,7 +264,7 @@ void dijkstra_with_visitor(
}
#else
const bool is_neighbor_undiscovered = (distances[static_cast<size_t>(vid)] == infinite);
const bool was_edge_relaxed = relax_target(uv, uid, w);
const bool was_edge_relaxed = relax_target(uv, uid, w);
#endif

if (is_neighbor_undiscovered) {
Expand Down
9 changes: 6 additions & 3 deletions include/graph/container/compressed_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,9 @@ class compressed_graph_base
}

friend constexpr edges_type edges(graph_type& g, const vertex_id_type uid) {
assert(static_cast<size_t>(uid + 1) < g.row_index_.size()); // in row_index_ bounds?
assert(static_cast<size_t>(g.row_index_[static_cast<size_t>(uid) + 1].index) <= g.col_index_.size()); // in col_index_ bounds?
assert(static_cast<size_t>(uid + 1) < g.row_index_.size()); // in row_index_ bounds?
assert(static_cast<size_t>(g.row_index_[static_cast<size_t>(uid) + 1].index) <=
g.col_index_.size()); // in col_index_ bounds?
return edges_type(g.col_index_.begin() + g.row_index_[static_cast<size_type>(uid)].index,
g.col_index_.begin() + g.row_index_[static_cast<size_type>(uid + 1)].index);
}
Expand All @@ -868,7 +869,9 @@ class compressed_graph_base
// target_id(g,uv), target(g,uv)
friend constexpr vertex_id_type target_id(const graph_type& g, const edge_type& uv) noexcept { return uv.index; }

friend constexpr vertex_type& target(graph_type& g, edge_type& uv) noexcept { return g.row_index_[static_cast<size_type>(uv.index)]; }
friend constexpr vertex_type& target(graph_type& g, edge_type& uv) noexcept {
return g.row_index_[static_cast<size_type>(uv.index)];
}
friend constexpr const vertex_type& target(const graph_type& g, const edge_type& uv) noexcept {
return g.row_index_[static_cast<size_type>(uv.index)];
}
Expand Down

0 comments on commit 55b0771

Please sign in to comment.