Skip to content

Commit b17eafe

Browse files
authored
Merge pull request #314 from AbhinJ/Abhinj-week-5
GSoC 2023: Abhinav Jain Week 5
2 parents 44990b6 + c1137bf commit b17eafe

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

docqueries/withPoints/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SET(LOCAL_FILES
44
doc-pgr_withPointsCost
55
doc-pgr_withPointsDD
66
doc-pgr_withPointsKSP
7+
doc-pgr_withPointsKSPv3.6
78
doc-pgr_withPoints
89
withPointsVia
910
)

docqueries/withPoints/test.conf

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
'comment' => 'Function test for any versions.',
66
'data' => ['sampledata.data'],
77
'tests' => [qw(
8-
doc-pgr_withPoints
9-
doc-pgr_withPointsCost
10-
doc-pgr_withPointsCostMatrix
11-
doc-pgr_withPointsDD
12-
doc-pgr_withPointsKSP
13-
withPointsVia
8+
doc-pgr_withPointsKSPv3.6
149
)],
1510
'documentation' => [qw(
1611
doc-pgr_withPoints

include/cpp_common/basePath_SSEC.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ class Path {
138138
Path_rt **ret_path,
139139
size_t &sequence, int routeId) const;
140140

141+
void get_pg_withPointsKSP_path(
142+
Path_rt **ret_path,
143+
size_t &sequence) const;
144+
141145
void get_pg_turn_restricted_path(
142146
Path_rt **ret_path,
143147
size_t &sequence, int routeId) const;

src/common/basePath_SSEC.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,24 @@ void Path::get_pg_ksp_path(
280280
}
281281
}
282282

283+
/* used by withPointsKSP */
284+
void Path::get_pg_withPointsKSP_path(
285+
Path_rt **ret_path,
286+
size_t &sequence) const {
287+
for (unsigned int i = 0; i < path.size(); i++) {
288+
(*ret_path)[sequence].seq = static_cast<int>(i + 1);
289+
(*ret_path)[sequence].start_id = start_id();
290+
(*ret_path)[sequence].end_id = end_id();
291+
(*ret_path)[sequence].node = path[i].node;
292+
(*ret_path)[sequence].edge = path[i].edge;
293+
(*ret_path)[sequence].cost = path[i].cost;
294+
(*ret_path)[sequence].agg_cost = (i == 0)?
295+
0 :
296+
(*ret_path)[sequence-1].agg_cost + path[i-1].cost;
297+
sequence++;
298+
}
299+
}
300+
283301
/* used by turn restricted */
284302
void Path::get_pg_turn_restricted_path(
285303
Path_rt **ret_path,

src/ksp/withPoints_ksp_driver.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,10 @@ pgr_do_withPointsKsp(
159159
*return_tuples = pgr_alloc(count, (*return_tuples));
160160

161161
size_t sequence = 0;
162-
int route_id = 0;
162+
// int route_id = 0;
163163
for (const auto &path : paths) {
164164
if (path.size() > 0)
165-
path.get_pg_ksp_path(return_tuples, sequence, route_id);
166-
++route_id;
165+
path.get_pg_withPointsKSP_path(return_tuples, sequence);
167166
}
168167

169168
if (count != sequence) {

0 commit comments

Comments
 (0)