Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxman Dhulipala committed Dec 4, 2024
1 parent c0529cb commit 7e75bff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
24 changes: 15 additions & 9 deletions benchmarks/PageRank/PageRank_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ namespace gbbs {

struct PageRank_ligra {
template <class Graph>
static sequence<double> compute_pagerank(Graph& G, double eps = 0.000001, size_t max_iters = 100) {
static sequence<double> compute_pagerank(Graph& G, double eps = 0.000001,
size_t max_iters = 100) {
return PageRank_edgeMap(G, eps, max_iters);
}
};

struct PageRank_opt {
template <class Graph>
static sequence<double> compute_pagerank(Graph& G, double eps = 0.000001, size_t max_iters = 100) {
static sequence<double> compute_pagerank(Graph& G, double eps = 0.000001,
size_t max_iters = 100) {
return PageRank(G, eps, max_iters);
}
};
Expand All @@ -45,7 +47,7 @@ TYPED_TEST(PageRankFixture, EdgelessGraph) {

using Impl = typename TestFixture::Impl;
const sequence<double> result = Impl::compute_pagerank(graph);
EXPECT_THAT(result, ElementsAre(1.0/3, 1.0/3, 1.0/3));
EXPECT_THAT(result, ElementsAre(1.0 / 3, 1.0 / 3, 1.0 / 3));
}

TYPED_TEST(PageRankFixture, Cycle) {
Expand All @@ -61,8 +63,7 @@ TYPED_TEST(PageRankFixture, Cycle) {

{
const sequence<double> result{Impl::compute_pagerank(graph)};
EXPECT_THAT(result,
ElementsAre(0.2, 0.2, 0.2, 0.2, 0.2));
EXPECT_THAT(result, ElementsAre(0.2, 0.2, 0.2, 0.2, 0.2));
}
}

Expand All @@ -72,15 +73,17 @@ TYPED_TEST(PageRankFixture, Path) {
//
constexpr uintE kNumVertices{3};
const std::unordered_set<UndirectedEdge> kEdges{
{0, 1}, {1, 2},
{0, 1},
{1, 2},
};
auto graph{graph_test::MakeUnweightedSymmetricGraph(kNumVertices, kEdges)};
using Impl = typename TestFixture::Impl;

{
const sequence<double> result{Impl::compute_pagerank(graph)};
const sequence<double> expected{0.2567570878, 0.4864858243, 0.2567570878};
EXPECT_THAT(result, testing::Pointwise(testing::DoubleNear(1e-4), expected));
EXPECT_THAT(result,
testing::Pointwise(testing::DoubleNear(1e-4), expected));
}
}

Expand All @@ -98,9 +101,12 @@ TYPED_TEST(PageRankFixture, BasicUndirected) {

{
const sequence<double> result{Impl::compute_pagerank(graph)};
const sequence<double> expected{0.1428571429, 0.1428571429, 0.0802049539, 0.2074472351, 0.1389813363, 0.2074472351, 0.0802049539};
const sequence<double> expected{0.1428571429, 0.1428571429, 0.0802049539,
0.2074472351, 0.1389813363, 0.2074472351,
0.0802049539};

EXPECT_THAT(result, testing::Pointwise(testing::DoubleNear(1e-4), expected));
EXPECT_THAT(result,
testing::Pointwise(testing::DoubleNear(1e-4), expected));
}
}

Expand Down
1 change: 0 additions & 1 deletion gbbs/edge_map_blocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ struct emhelper {
auto& vec = perthread_blocks[group_id * kThreadBlockStride];
if (vec.size() == 0) { // alloc new
block_ptr = gbbs::new_array_no_init<em_data_block>(1);
std::cout << "Allocating!" << std::endl;
vec.emplace_back(block_ptr);
block_ptr->block_size = 0;
} else {
Expand Down
14 changes: 7 additions & 7 deletions gbbs/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
// Copyright (c) 2018 Laxman Dhulipala, Guy Blelloch, and Julian Shun
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
Expand All @@ -17,9 +17,9 @@
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

Expand Down

0 comments on commit 7e75bff

Please sign in to comment.