-
-
Notifications
You must be signed in to change notification settings - Fork 366
GSoC 2023 Implementing Dijkstra’s Driving distance Function and its migration
- Proposal
- Participants
- Weekly Report and Plan
- Log of Pull Requests
- Final Report
The project aims to implement a new function called "pgr_dijkstraDD" that replaces the existing "pgr_drivingDistance" function. The new function will have all overloads,including single and multiple vertices as before. The function will return columns such as sequence, depth, start vertex ID, node, edge, cost, and aggregate cost for all overloads. The project will also include testing of the new function with pgTap Tests.Documentation for the new function and migration guides for users to switch to the new function will also be created.The Dijkstra’s Driving Distance algorithm is employed to extract all nodes that can be reached from the root node with cost of reaching not exceeding the given distance D. This algorithm is primarily based on Dijkstra's Algorithm.
Signature of current pgr_drivingDistance function:
pgr_drivingDistance(Edges SQL, Root vid, distance, [directed])
pgr_drivingDistance(Edges SQL, Root vids, distance, [options])
options: [directed, equicost]
RETURNS SET OF (seq, [from_v,] node, edge, cost, agg_cost)
Currently the function does not have a depth column which tells the distance of a particular node from the root node.Signatures, Column names, and its contents are not consistent.Other than the above two stated points, the function “pgr_drivingDistance” is accurate, stable and gives correct results.
- It is one of the widely used functions from all the pgRouting functions.Because it operates on dijkstra function which is of utmost importance in the pgRouting library.
- Added extra Depth Column
- Postgres does not allow two functions with the same set of input parameters but with different output columns.
- While making changes to the function we don’t want to break other user’s code while it is in testing and is stable .So we make a renamed function side by side ,so that it doesn’t affect the stable function.
- pgr_dijkstraDD is better because it uses the algorithm inventor’s name.
- Completing the project would make the name and structure of the function similar to other functions https://docs.pgrouting.org/dev/en/pgr_primDD.html https://docs.pgrouting.org/dev/en/pgr_kruskalDD.html
- Open source: “pgr_dijkstraDD” function is part of the open-source pgRouting extension, which means that it is free to use and can be customised by users to meet their specific needs.
- 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:-
- Make and implement “pgr_dijkstraDD” function with all overloads: ➔ Single Vertex ➔ Multiple Vertices
- C, C++, SQL code related to that function
- Return columns on both the overloads: Seq, depth, start_vid, node, edge, cost, agg_cost
- Return columns on all the overloads will be seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost
- Basic pgTap Tests
- Full weekly report of evaluations
- Documentation of the new function
Detailed Proposal in PDF format
Title | GitHub Handle | Name |
---|---|---|
1st Mentor | @shobhit162 | Shobhit Chaurasia |
2nd Mentor | @robe2 | Regina Obe |
Student Software Developer | @aryan1010 | Aryan Gupta |
- 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
- I will engage with my mentors, participate more actively in discussions, and learn more about pgRouting.
- Learn the pgRouting coding style from Google C++ Style Guide
- Adopt the pgRouting-established standards for development, documentation, and testing.
- Set up the wiki page to keep track of weekly progress.
- Introduced myself and my project in the soc mailing list [1] and requested feedback or suggestions on the project.
- Added the links to the wiki page and the public repository in the OSGeo Accepted Students' wiki page [2].
- Created my GSoC project wiki page in the pgrouting repository, where I will be regularly updating the weekly reports [3].
- Studied Google's GSoC students guide and the OSGeo's specific instructions.
- Met with the mentors and the core developer of pgRouting, to discuss the final name of the function in this project [4], some possible additional works.
- Design “pgr_dijkstraDD” function
- Create the new single vertex renamed function
- Reuse and Duplicate Code when possible
- Understanding and getting deep into previous code (“pgr_drivingdistance”)
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Created a branch "aryan-2023" on GSoC-pgRouting repository.
- Revised the functioning of algorithm and went through the related code again
- Made a PR of adding my name to contributor list.
- Studied the video: https://video.osgeo.org/w/qC7HNRU783f6aqpysigF87
- With PR: https://github.com/pgRouting/pgrouting/pull/2521
- Built pgRouting locally, tested it using the sample queries, and set up the development environment in preparation for coding.
-
What do I plan on doing next week?
- Catch up my week 1 work in week 2.
- Create a basic structure for documentation, C, C++ and SQL.
- Start developing the *pgr_drivingdistance() *function.
-
Am I blocked on anything?
- Nothing MAJOR
- Design the detailed signature for the “pgr_dijkstraDD” function
- Make Basic Code skeleton of SQL,C and C++ files
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Made a WIKI page regarding run.sh and taptest.sh as suggested by Vicky ma’am.
- https://github.com/pgRouting/pgrouting/wiki/Understanding-run.sh-and-taptests.sh
- Added the extra column start_vid to both single vertex and renamed the from_vid for multiple vertices to start_vid
- Fixed corresponding docqueries and pgtap testcases.
-
What do I plan on doing next week?
- Catch up my week 1 work in week 2.
- plan on adding the depth column with reference to pgr_primDD/pgr_kruskalDD
-
Am I blocked on anything?
- Nothing MAJOR
- Create C++ containers for passing SQL data to C++ containers for data processing
- Refine the code
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Fixed Dijkstra issue 729 from week 2
- Reverted back the pgtap tests and the docqueries
- Created new docqueries
- Brought back the all previous functions due to the issue of backward compatibility.
-
What do I plan on doing next week?
- Catching up on week 3 pull request.
- plan on adding the depth column with reference to pgr_primDD/pgr_kruskalDD
-
Am I blocked on anything?
- Nothing MAJOR
- Creation of helper class, wrappers.
- Implementing Single vertex and Multiple Vertices
- Test against OSM data
- Make sure the eros are properly handled
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Read the whole code of prim_dd and kruskal_dd and tried to understand the working
- Added a new structure path_rtdd
- made some new v4 files
- adjusted function names according to the new files
-
What do I plan on doing next week?
- Catching up on week 3 pull request.
- plan on adding the depth column with reference to pgr_primDD/pgr_kruskalDD
-
Am I blocked on anything?
- think i need more info on the path structures i.e. basepath_ssec.cpp and basepath_ssec.hpp .It would be very helpful to everyone as all functions need it.
- Write appropriate queries using the pgRouting documentation's sample data.
- Work on the submissions required as part of the first evaluation.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Read and understood depth_first_search function from pgr_mst.hpp and prim_dd trying to understand the flow of programs.
- Fixed the docqueries (according to the new one i made)
- adjusted function names according to the new files
-
What do I plan on doing next week?
- Catching up on week 5 pull request issues.
- Updating the v4drivingDist.hpp and v4drivedist_driver.cpp with the help of pgr_mst.hpp and pgr_prim.hpplDD
- Add Depth Column
-
Am I blocked on anything?
- Nothing major
- Prepare user documentation.
- Prepare a report for the first evaluation
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Added the depth column to the pgr_drivingdistance function
- Used the path type = Mst_rt (it has depth in it ) for passing the tuples
- Used boost:depth_first_search function for the returning depth
- The function is working and returning all the columns
-
What do I plan on doing next week?
- Catching up on week 6 pull request issues.
- Do the changes suggested by @vicky ,that includes
- Fixing all the pgtap testcases till now (except one )
- Fixing all the docqueries till now
- Removing the extraneous v4 files and combining them with the old files
-
Am I blocked on anything?
- Nothing major
- Submit a working pgr_dijsktraDD( ) function with its documentation (without pgTap tests)
- Work on the feedback provided from the first evaluation.
- Bug fixing.
- Preparing second coding period Synopsis
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Did the changes suggested by @vicky ,that includes
- Fixed all the pgtap testcases till now (except one )
- Fixed all the docqueries till now
- Removed the extraneous v4 files and combining them with the old files
-
What do I plan on doing next week?
- Catching up on week 7 pull request issues.
- Fix the issue_519 [pgtap] and optimise the hpp file
- Fix the documentation of pgr_drivingdistance
-
Am I blocked on anything?
- Nothing major
- Internal tests for “pgr_dijkstraDD”
- No server crash test
- pgTap Unit tests
- Create queries and results for documentation using the pgRouting sample data.
- Creating Documentation on Migrating thenew function
- Fix all the bugs/problems and documentation details.
- Wiki Page
- Verify documentation and migration documentation works Prepare final submission along with full documentation.
- Submit the complete project with all the required functions, documentation and unit tests.
Pull Request | Description | Date | Status |
---|---|---|---|
#293 | GSoC-2023 Week-01: pgr_drivingdistance | June 5th, 2023 | Merged |
#296 | GSoC-2023 Week-02: pgr_drivingdistance | June 11th, 2023 | Merged |
#305 | GSoC-2023 Week-03: pgr_drivingdistance | June 18th, 2023 | Merged |
#310 | GSoC-2023 Week-04: pgr_drivingdistance | June 25th, 2023 | Merged |
#311 | GSoC-2023 Week-05: pgr_drivingdistance | July 1st, 2023 | Merged |
#315 | GSoC-2023 Week-06: pgr_drivingdistance | July 8th, 2023 | Merged |
#321 | GSoC-2023 Week-07: pgr_drivingdistance | July 15th, 2023 | Merged |
GSoC-2023 Week-08: pgr_drivingdistance | Merged | ||
GSoC-2023 Week-08: pgr_drivingdistance | Merged | ||
GSoC-2023 Week-08: pgr_drivingdistance | Merged | ||
GSoC-2023 Week-08: pgr_drivingdistance | Merged | ||
GSoC-2023 Week-08: pgr_drivingdistance | Merged |
- Graph Maker used : https://csacademy.com/app/graph_editor/
- https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
- Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2022). Introduction to algorithms. The MIT Press.
- Sharma, P.K., & Planiya, A. (2016). Shortest Path Finding of Wireless Optical Network using Dijkstra Algorithm and Analysis of Delay and Blocking Probability:
- https://www.rsisinternational.org/IJRSI/Issue26/77-84.pdf
- Journal UGC-CARE IJCRT( ISSN: 2320-2882 ):
- https://www.ijcrt.org/viewfull.php?&p_id=IJCRT2012240
- Behún, M., Knežo, D., Cehlár, M., Knapčíková, L., & Behúnová, A. (2022). Recent application of Dijkstra’s algorithm in the process of production lanning. Applied Sciences, 12(14), 7088. https://doi.org/10.3390/app12147088 :
- https://www.mdpi.com/2076-3417/12/14/7088/pdf#:~:text=Dijkstras%20algorithm%20solves%20many%20of,vertices%20from%20the%20target%20vertex.34
- https://www.baeldung.com/cs/dijkstra
- https://www.scaler.com/topics/data-structures/dijkstra-algorithm/
- https://www.studytonight.com/data-structures/dijkstras-algorithm
- https://docs.pgrouting.org/dev/en/pgr_drivingDistance.html
- https://docs.pgrouting.org/dev/en/pgr_primDD.html
- https://www.postgresql.org/docs/current/xfunc-c.html
- https://www.postgresql.org/docs/current/sql-createfunction.html
- https://docs.pgrouting.org/latest/en/sampledata.html
- https://github.com/pgRouting/pgrouting
- https://www.boost.org/doc/libs/1_81_0/libs/graph/example/dijkstra-example.cpp
- https://www.boost.org/doc/libs/1_81_0/libs/graph/doc/dijkstra_shortest_paths.html