diff --git a/src/graph/executor/algo/AllPathsExecutor.cpp b/src/graph/executor/algo/AllPathsExecutor.cpp index 38025ae915d..58db86ff423 100644 --- a/src/graph/executor/algo/AllPathsExecutor.cpp +++ b/src/graph/executor/algo/AllPathsExecutor.cpp @@ -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 { @@ -402,7 +405,7 @@ folly::Future> AllPathsExecutor::doBuildPath( } } return folly::collect(futures).via(runner()).thenValue( - [this, pathPtr = std::move(currentPathPtr), step](std::vector>&& paths) { + [pathPtr = std::move(currentPathPtr)](std::vector>&& paths) { memory::MemoryCheckGuard guard; std::vector result = std::move(*pathPtr); for (auto& path : paths) { diff --git a/src/graph/executor/algo/AllPathsExecutor.h b/src/graph/executor/algo/AllPathsExecutor.h index 223cc236790..3446fc7df71 100644 --- a/src/graph/executor/algo/AllPathsExecutor.h +++ b/src/graph/executor/algo/AllPathsExecutor.h @@ -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; diff --git a/src/graph/executor/query/TraverseExecutor.h b/src/graph/executor/query/TraverseExecutor.h index 287832026eb..629718b34b5 100644 --- a/src/graph/executor/query/TraverseExecutor.h +++ b/src/graph/executor/query/TraverseExecutor.h @@ -5,7 +5,7 @@ #ifndef EXECUTOR_QUERY_TRAVERSEEXECUTOR_H_ #define EXECUTOR_QUERY_TRAVERSEEXECUTOR_H_ -// #include +#include #include "graph/executor/StorageAccessExecutor.h" #include "graph/planner/plan/Query.h"