Skip to content

Commit

Permalink
Merge pull request #91 from ywhz/master
Browse files Browse the repository at this point in the history
fix: get_partition_id return error partition_id
  • Loading branch information
xuguruogu authored May 14, 2020
2 parents f0e5c91 + 5346745 commit 9ca04c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plato/graph/partition/sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9ca04c3

Please sign in to comment.