Skip to content

Commit

Permalink
Merge pull request #92 from ustcyu/master
Browse files Browse the repository at this point in the history
Update sequence.hpp
  • Loading branch information
xuguruogu authored May 14, 2020
2 parents 9ca04c3 + e4b3ae6 commit 06f3a78
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions plato/graph/partition/sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,14 @@ class sequence_balanced_by_source_t {

// get vertex's partition
inline int get_partition_id(vid_t v_i) {
if(v_i >= offset_.back()){
CHECK(false) << "can not find which partition " << v_i << " belong";
abort();
for (size_t p_i = 0; p_i < (offset_.size() - 1); ++p_i) {
if (v_i >= offset_[p_i] && v_i < offset_[p_i + 1]) {
return p_i;
}
}
auto t = std::upper_bound(offset_.begin(), offset_.end(), v_i);
int partition_id = std::distance(offset_.begin(), t);
return partition_id > 0 ? partition_id - 1 : partition_id;
CHECK(false) << "can not find which partition " << v_i << " belong";
// add abort() to make gcc 6 happy. Otherwise compile failed due to -Werror=return-type.
abort();
}

// get all self vertex's view
Expand Down Expand Up @@ -211,13 +212,14 @@ class sequence_balanced_by_destination_t {

// get vertex's partition
inline int get_partition_id(vid_t v_i) {
if(v_i >= offset_.back()){
CHECK(false) << "can not find which partition " << v_i << " belong";
abort();
for (size_t p_i = 0; p_i < (offset_.size() - 1); ++p_i) {
if (v_i >= offset_[p_i] && v_i < offset_[p_i + 1]) {
return p_i;
}
}
auto t = std::upper_bound(offset_.begin(), offset_.end(), v_i);
int partition_id = std::distance(offset_.begin(), t);
return partition_id > 0 ? partition_id - 1 : partition_id;
CHECK(false) << "can not find which partition " << v_i << " belong";
// add abort() to make gcc 6 happy. Otherwise compile failed due to -Werror=return-type.
abort();
}

sequence_v_view self_v_view(void) {
Expand Down

0 comments on commit 06f3a78

Please sign in to comment.