Skip to content

Commit a1bbda8

Browse files
committed
add continue statement in c++ logic to prevent double-counting costs
1 parent b036cd7 commit a1bbda8

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

pgtap/withPoints/withPoints/edge_cases/issue_2966.pg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ BEGIN
5757
);
5858

5959
-- Test 2: fraction = 1 should ALSO work correctly
60-
-- BUG: Currently returns 105 instead of 17
60+
-- Regression test: previously returned 105 instead of 17
6161
RETURN QUERY SELECT set_eq(
6262
$$SELECT agg_cost::TEXT FROM pgr_withPoints(
6363
'SELECT * FROM test_edges',

src/withPoints/withPoints.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ Pg_points_graph::create_new_edges() {
401401
Edge_t zero_edge = {edge.id, edge.target, -point.pid, 0, 0};
402402
m_new_edges.push_back(zero_edge);
403403

404-
// Issue #2966 fix: Also create edge from prev_target to this point
404+
// Also create edge from previous target to this point
405405
// This allows Dijkstra to find the direct path through this edge
406406
double delta = point.fraction - prev_fraction;
407407
if (delta > 0) {
@@ -442,6 +442,7 @@ Pg_points_graph::create_new_edges() {
442442
prev_rfraction = point.fraction;
443443
agg_rcost += last_rcost;
444444
}
445+
continue;
445446
}
446447
if (point.fraction > 0 && point.fraction < 1) {
447448
log << "vertex_id of the point is " << -point.pid << "\n";

0 commit comments

Comments
 (0)