From 956db9393511786187ccdb102593fd8bf8366606 Mon Sep 17 00:00:00 2001 From: suhang Date: Thu, 14 May 2020 12:45:24 +0800 Subject: [PATCH 1/2] fix: get_partition_id return error partition_id --- plato/graph/partition/sequence.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plato/graph/partition/sequence.hpp b/plato/graph/partition/sequence.hpp index 3fdfba3b..896939bb 100644 --- a/plato/graph/partition/sequence.hpp +++ b/plato/graph/partition/sequence.hpp @@ -60,7 +60,7 @@ void __init_offset(std::vector* poffset, const DT* degrees, vid_t vertice for (vid_t v_i = poffset->at(p_i); v_i < vertices; ++v_i) { amount += (alpha + degrees[v_i]); if (amount >= expected_amount) { - poffset->at(p_i + 1) = v_i / PAGESIZE * PAGESIZE; + poffset->at(p_i + 1) = v_i; break; } } @@ -155,7 +155,8 @@ class sequence_balanced_by_source_t { abort(); } auto t = std::upper_bound(offset_.begin(), offset_.end(), v_i); - return *(--t); + int partition_id = std::distance(offset_.begin(), t); + return partition_id > 0 ? partition_id - 1 : partition_id; } // get all self vertex's view @@ -215,7 +216,8 @@ class sequence_balanced_by_destination_t { abort(); } auto t = std::upper_bound(offset_.begin(), offset_.end(), v_i); - return *(--t); + int partition_id = std::distance(offset_.begin(), t); + return partition_id > 0 ? partition_id - 1 : partition_id; } sequence_v_view self_v_view(void) { From 5346745c88fa70402cd4b694365f9ef47d7028fb Mon Sep 17 00:00:00 2001 From: suhang Date: Thu, 14 May 2020 13:08:17 +0800 Subject: [PATCH 2/2] fix: get_partition_id return error partition_id --- plato/graph/partition/sequence.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plato/graph/partition/sequence.hpp b/plato/graph/partition/sequence.hpp index 896939bb..870d61f7 100644 --- a/plato/graph/partition/sequence.hpp +++ b/plato/graph/partition/sequence.hpp @@ -60,7 +60,7 @@ void __init_offset(std::vector* poffset, const DT* degrees, vid_t vertice for (vid_t v_i = poffset->at(p_i); v_i < vertices; ++v_i) { amount += (alpha + degrees[v_i]); if (amount >= expected_amount) { - poffset->at(p_i + 1) = v_i; + poffset->at(p_i + 1) = v_i / PAGESIZE * PAGESIZE; break; } }