Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Mar 20, 2023
1 parent d4d552b commit 5875f89
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/graph/executor/algo/AllPathsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
#include "graph/planner/plan/Algo.h"
#include "graph/service/GraphFlags.h"

DEFINE_uint32(path_threshold_size, 100, "");
DEFINE_uint32(path_threshold_ratio, 2, "");
DEFINE_uint32(
path_threshold_size,
100,
"the number of vids to expand, when this threshold is exceeded, use heuristic expansion");
DEFINE_uint32(path_threshold_ratio, 2, "threshold for heuristics expansion");
DEFINE_uint32(path_batch_size, 5000, "number of paths constructed by each thread");

namespace nebula {
Expand Down Expand Up @@ -402,7 +405,7 @@ folly::Future<std::vector<Row>> AllPathsExecutor::doBuildPath(
}
}
return folly::collect(futures).via(runner()).thenValue(
[this, pathPtr = std::move(currentPathPtr), step](std::vector<std::vector<Row>>&& paths) {
[pathPtr = std::move(currentPathPtr)](std::vector<std::vector<Row>>&& paths) {
memory::MemoryCheckGuard guard;
std::vector<Row> result = std::move(*pathPtr);
for (auto& path : paths) {
Expand Down
20 changes: 20 additions & 0 deletions src/graph/executor/algo/AllPathsExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@

#include "graph/executor/PathBaseExecutor.h"

// Using the two-way BFS algorithm, a heuristic algorithm is used in the expansion process
// when the number of vid to be expanded on the left and right
// exceeds the threshold(FLAGS_path_threshold_size)

// if size(leftVids) / size(rightVids) >= FLAGS_path_threshold_ratio(default 2)
// expandFromRight
// else if size(rightVids) / size(leftVids) >= FLAGS_path_threshold_ratio(default 2)
// expandFromLeft
// else
// expandFromLeft
// expandFromRight
// this way can avoid uneven calculation distribution due to data skew
// finally the path is constructed using an asynchronous process in the adjacency list

// adjList is an adjacency list structure
// which saves the vids and all adjacent edges that expand one step
// when expanding, if the vid has already been visited, do not visit again
// leftAdjList_ save result of forward expansion
// rightAdjList_ save result of backward expansion

namespace nebula {
namespace graph {
class AllPaths;
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/query/TraverseExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef EXECUTOR_QUERY_TRAVERSEEXECUTOR_H_
#define EXECUTOR_QUERY_TRAVERSEEXECUTOR_H_

// #include <robin_hood.h>
#include <robin_hood.h>

#include "graph/executor/StorageAccessExecutor.h"
#include "graph/planner/plan/Query.h"
Expand Down

0 comments on commit 5875f89

Please sign in to comment.