Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Apr 19, 2022
1 parent 162b6c1 commit 24eb885
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/graph/executor/algo/BFSShortestPathExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,12 @@ folly::Future<Status> BFSShortestPathExecutor::conjunctPath() {
std::vector<folly::Future<DataSet>> futures;
for (auto& vid : meetVids) {
batchVids.push_back(vid);
if (i == totalSize - 1 || batchVids.size() == batchSize) {
if (++i == totalSize || batchVids.size() == batchSize) {
auto future = folly::via(runner(), [this, vids = std::move(batchVids), oddStep]() {
return doConjunct(vids, oddStep);
});
futures.emplace_back(std::move(future));
}
i++;
}

return folly::collect(futures).via(runner()).thenValue([this](auto&& resps) {
Expand Down
7 changes: 5 additions & 2 deletions src/graph/executor/algo/MultiShortestPathExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ folly::Future<Status> MultiShortestPathExecutor::execute() {
historyRightPaths_[iter.first].insert(std::make_move_iterator(iter.second.begin()),
std::make_move_iterator(iter.second.end()));
}
leftPaths_.clear();
rightPaths_.clear();

step_++;
DataSet ds;
Expand All @@ -66,13 +68,16 @@ void MultiShortestPathExecutor::init() {
auto& vid = rIter->getColumn(0);
if (rightVids.emplace(vid).second) {
std::vector<Path> tmp({Path(Vertex(vid, {}), {})});
historyRightPaths_[vid].emplace(vid, tmp);
preRightPaths_[vid].emplace(vid, std::move(tmp));
}
}

std::set<Value> leftVids;
for (; lIter->valid(); lIter->next()) {
auto& vid = lIter->getColumn(0);
std::vector<Path> tmp({Path(Vertex(vid, {}), {})});
historyLeftPaths_[vid].emplace(vid, std::move(tmp));
leftVids.emplace(vid);
}
for (const auto& leftVid : leftVids) {
Expand Down Expand Up @@ -130,8 +135,6 @@ Status MultiShortestPathExecutor::buildPath(bool reverse) {
std::vector<Path> tmp({std::move(path)});
currentPaths[dst].emplace(src, std::move(tmp));
}
std::vector<Path> start({Path(Vertex(src, {}), {})});
currentPaths[src].emplace(src, std::move(start));
}
} else {
auto& historyPaths = reverse ? historyRightPaths_ : historyLeftPaths_;
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/algo/ProduceAllPathsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ folly::Future<Status> ProduceAllPathsExecutor::conjunctPath() {

auto startIter = leftPaths_.begin();
for (auto leftIter = leftPaths_.begin(); leftIter != leftPaths_.end(); ++leftIter) {
if (i++ == batchSize) {
if (++i == batchSize) {
auto endIter = leftIter;
endIter++;
auto oddStepFuture = folly::via(
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/test/FindPathTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ TEST_F(FindPathTest, multiSourceShortestPath) {
{
DataSet expectLeftVid;
expectLeftVid.colNames = {nebula::kVid};
for (const auto& vid : {"a", "b", "c", "f", "g"}) {
for (const auto& vid : {"b", "f", "g"}) {
Row row;
row.values.emplace_back(vid);
expectLeftVid.rows.emplace_back(std::move(row));
Expand Down

0 comments on commit 24eb885

Please sign in to comment.