Skip to content

Commit

Permalink
Keep the original algorithm consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
SiberiaWolfP committed Feb 20, 2024
1 parent 79b7495 commit 90c6085
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static void IterativeLengthFunction(DataChunk &args, ExpressionState &state,
int64_t search_num = lane_to_num[lane];
if (search_num >= 0) { // active lane
int64_t dst_pos = vdata_dst.sel->get_index(search_num);
if (seen[dst_data[dst_pos]][lane]){
if (seen[dst_data[dst_pos]][lane]) {
result_data[search_num] =
iter; /* found at iter => iter = path length */
lane_to_num[lane] = -1; // mark inactive
Expand Down
6 changes: 5 additions & 1 deletion duckpgq/src/duckpgq/functions/scalar/shortest_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void ShortestPathFunction(DataChunk &args, ExpressionState &state,
vector<std::vector<int64_t>> parents_v(v_size,
std::vector<int64_t>(LANE_LIMIT, -1));
vector<std::vector<int64_t>> parents_e(v_size,
std::vector<int64_t>(LANE_LIMIT, -1));
std::vector<int64_t>(LANE_LIMIT, -1));

// maps lane to search number
int16_t lane_to_num[LANE_LIMIT];
Expand All @@ -113,6 +113,10 @@ static void ShortestPathFunction(DataChunk &args, ExpressionState &state,
for (auto i = 0; i < v_size; i++) {
seen[i] = 0;
visit1[i] = 0;
for (auto j = 0; j < LANE_LIMIT; j++) {
parents_v[i][j] = -1;
parents_e[i][j] = -1;
}
}

// add search jobs to free lanes
Expand Down

0 comments on commit 90c6085

Please sign in to comment.