-
-
Notifications
You must be signed in to change notification settings - Fork 384
GSoC 2023 Implement pgr_KSP and Add All Overloads
- Proposal
- Participants
- Weekly Report and Plan
- Log of Pull Requests
- Final Report
- References
The implementation of a pgr_yen() function that can calculate K shortest paths for various scenarios is essential for many applications. This project aims to implement a pgr_yen function that can handle five different scenarios that are one-to-one, one-to-many, many-to-one, many-to-many, and combinations of (source, target). By implementing such a function, we can efficiently and accurately find multiple shortest paths for different scenarios and improve the performance of various applications that rely on this functionality. This also includes the deprecation of pgr_ksp by making migration documentation of this new function.
Signature of current pgr_KSP function:
pgr_KSP(Edges SQL, start vid, end vid, K, [options])
options: [directed, heap_paths]
RETURNS SET OF (seq, path_id, path_seq, node, edge, cost, agg_cost)
OR EMPTY SET
As of now, the pgr_ksp function is already there in pgRouting but it doesn’t have the mentioned overloads. There are more functions based on pgr_ksp, so pgr_ksp acts as a base function for them. That’s why we need the implementation of pgr_yen with all the overloads: One-to-one, one-to-many, many-to-one, many-to-many, and combinations. Also, pgr_ksp is based on Yen’s algorithm and Postgres does not allow two functions with the same set of input parameters but with different output columns. So, it is more logical to rename it as pgr_yen.
Adding the pgr_yen function to pgRouting will be useful for various scenarios. A few are:
- It can calculate at most k shortest paths between two nodes.
- It will work in the single source and single target scenario.
- It will work in the single source and multiple targets scenario.
- It will work in multiple sources and single target scenarios.
- It will work in multiple sources and multiple target scenarios.
- It will work for combinations of sources and targets as well.
- These overloads will make the algorithm ready for more practical routing in real-world usage.
- Adding this algorithm to pgRouting will result in more functionalities in pgRouting which will help the current and future users and developers to use and integrate it with other algorithms.
The deliverables at the end of the GSoC period are:-
- Implementation of pgr_yen( ) function with all overloads.
- Code with detailed comments.
- User’s documentation.
- Return columns on all the overloads will be seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost
- Documentation on how to migrate from pgr_ksp to pgr_yen.
- A wiki page for each week’s progress and product created.
- Basic pgTap tests for the mentioned function equivalence with pgr_dijkstra when
k=1.
Detailed Proposal in PDF format
| Title | GitHub Handle | Name |
|---|---|---|
| 1st Mentor | @krashish8 | Ashish Kumar |
| 2nd Mentor | @shobhit162 | Shobhit Chaurasia |
| Student Software Developer | @Aniket-debug | Aniket Agarwal |
- Task 1: Intent of application
- Task 2: Experience with GitHub & Git
- Task 3: Build locally pgRouting
- Task 4: Get familiar with C++
- Task 5: Get familiar with pgRouting
- Introduce myself to the community, interact with mentors, and actively get involved in the discussion.
- Setting up the Development Environment
- Develop a better understanding of PostgreSQL, PostGIS and how they interact with pgRouting.
- Set up the wiki page to keep track of weekly progress.
- Report Mail - SoC, pgRouting-dev
- The work I did in this week:
-
My Plans for next week:
- Discuss the Doubts with meteors.
- Understand the significance of Heap_Paths.
- Will do Some changes in the Code to create a structure for one-to-many if time allows.
- Report Mail - SoC, pgRouting-dev
-
The work I did in this week:
- Watch Twitch about the simplification of bdAstar
- Added all the overloads in pgr_ksp and passed doc-queries
- PR Link: Link
-
My Plans for next week:
- Catch up on my week 2 work.
- fix pgtap cases.
- Report Mail - SoC, pgRouting-dev
-
The work I did in this week:
- Created new files: v6ksp.c, v6ksp_driver.cpp, and v6ksp_driver.h.
- Removed all the changes made last week from ksp.c, ksp_driver.cpp, and ksp_driver.h.
- Added docqueries for one-to-many, many-to-one, many-to-many, and combinations.
- Made additional changes in several files to support the functionality of the newly added files.
- PR Link: Link
-
My Plans for next week:
- Catch up on my week 3 work.
- Fix pgtap cases and some checks (the failing ones).
- Report Mail - SoC, pgRouting-dev
- The work I did in this week:
-
My Plans for next week:
- Catch up on my week 4 work.
- Fix pgtap cases.
- Report Mail - SoC, pgRouting-dev
-
The work I did in this week:
- added start_vid and end_vid to the one-to-one overload
- fixed pgtap tests (type_checks.pg)
- PR Link: Link
-
My Plans for next week:
- Catch up on my week 5 work.
- Will start working on documentation.
- Report Mail - SoC, pgRouting-dev
-
The work I did in this week:
- updated ksp doc
- Added more docqueries
- PR Link: Link
-
My Plans for next week:
- Catch up on my week 6 work.
- Will review my work with mentors and do the work accordingly.
- Submit a working pgr_ksp( ) function with its documentation (without pgTap tests).
- Report Mail - SoC, pgRouting-dev
-
The work I did in this week:
- Fixed the pgtap test cases.
- Fixed the documentation.
- Removed the extraneous v4 files and combined them with the old files.
- PR Link: Link
-
My Plans for next week:
- Catch up on my week 7 work.
- Report Mail - SoC, pgRouting-dev
-
The work I did in this week:
- updated following pagtap tests files:
- no_crash_test.
- inner_query.
- PR Link: Link
-
My Plans for next week:
- Catch up on my week 8 work.
- Update tests before Week 9 starts: Link
- Update tests at the end of Week 9:
- Fix bugs in the unit test.
- Create queries for documentation using the pgRouting sample data.
- Review, Verify documentation
- Migration documentation work.
- Prepare PR for the main repository.
- Prepare the final report.
- Submit the complete project with all the required files and final report.
- Submit the mentor evaluation.
- Mentors will evaluate my work.
- Mentors will submit my final evaluations.
| Pull Request | Description | Date | Status |
|---|---|---|---|
| #326 | GSoC-2023: Aniket Agarwal Week 8 | July 23rd, 2023 | merged |
| #322 | GSoC-2023: Aniket Agarwal Week 7 | July 16th, 2023 | merged |
| #316 | GSoC-2023: Aniket Agarwal Week 6 | July 9th, 2023 | merged |
| #312 | GSoC-2023: Aniket Agarwal Week 5 | July 2nd, 2023 | merged |
| #307 | GSoC-2023: Aniket Agarwal Week 4 | June 25th, 2023 | merged |
| #302 | GSoC-2023: Aniket Agarwal Week 3 | June 18th, 2023 | merged |
| #295 | GSoC-2023: Aniket Agarwal Week 2 | June 10th, 2023 | merged |
| #290 | GSoC-2023: Aniket Agarwal Week 1 | June 6th, 2023 | merged |
- pgRouting GSoC Ideas
- pgRouting Documentation
- Algorithms Index for pgRouting
- pgRouting Sample Graph Data for pgTap testing
- [pgr_ksp() Documentation
- Wikipedia Yen’s Algorithm
- Boost Library
- pgr_dijkstra() Documentation
- OSGeo GSoC recommendation
- GSoC Program rules