GSoC 2026 Maximum Weighted Matching Algorithm - pgRouting/pgrouting GitHub Wiki
This project aims to implement the Maximum Weighted Matching Algorithm from the Boost Graph Library into pgRouting, is an algorithm for finding an optimal set of independent edges in a weighted graph such that the sum of their weights is maximized. The algorithm generates an optimal pairing of vertices that maximizes the total relationship value, improving the efficiency of resource allocation, fleet management, and complex assignment problems. The algorithm works by iteratively discovering augmenting paths and resolving odd-length cycles (using strategies like Edmonds' blossom shrinking) to systematically pair graph vertices, with a typical time complexity of O(V3 ) and space complexity of O(V + E), where V is the number of vertices and E is the number of edges. This implementation will enhance pgRouting's capabilities in combinatorial optimization, benefiting applications that require advanced pairing and relationship maximization.
Until now, maximum weighted matching has not been implemented in pgRouting. However, among the graph algorithms provided by the Boost C++ Libraries, no matching-related algorithm has been integrated into pgRouting so far.
- Implementation of pgr_maximumWeightedMatching().
- Code with clear and essential comments, following style guides and best practices.
- User documentation for the new function.
- Basic pgTap test cases.
- A wiki page detailing weekly progress.
- Detailed reports for the first and final evaluations.
| Title | GitHub Handle | Name |
|---|---|---|
| 1st Mentor | @krashish8 | Ashish Kumar |
| 2nd Mentor | @cvvergara | Vicky Vergara |
| Student Developer | @mayurgalhate | Mayur Galhate |
Note: in reverse order: the most recent is first
week 12
Dates: (August 10th – August 16th)
Proposed:
- Prepare and submit the final project report.
- Raise the issue and submit the final PR to the
pgRouting/pgroutingrepository targeting thedevelopbranch. - Add my name to
doc/src/pgRouting-introduction.rst. - Update
doc/src/release_notes.rstwith the relevant changes forpgr_maxWeightedMatching. - Complete the final documentation and cleanup changes before submitting the PR.
- Raised the issue and submitted the final PR to the
pgRouting/pgroutingrepository targeting thedevelopbranch. - Added my name to
doc/src/pgRouting-introduction.rst. - Updated
doc/src/release_notes.rstwith the relevant changes forpgr_maxWeightedMatching. - Completed the final documentation and cleanup changes before submitting the PR.
week 11
Dates: (August 3rd – August 9th)
Proposed:
- Preparing for Final Delivery
- Integrating to develop branch in the main repository
- Check the existing process/driver options for
pgr_maxWeightedMatchingand determine whether one supports theIID_t_rtreturn type. - Since no existing process/driver fits
IID_t_rt, create the required process and driver files for the new return type. - Add
pgr_maxWeightedMatchingto the new process/driver using theMAXWEIGHTEDMATCHINGcase. - Update the enumeration,
get_name(), and function entry point to use the new process architecture. - Resolve merge conflicts and synchronize the changes with the latest branch.
- Open a Boost version proof-of-concept PR to begin testing Boost compatibility in CI.
- Checked the existing process/driver options and confirmed that none supported the
IID_t_rtreturn type required bypgr_maxWeightedMatching. - Created the required process and driver files for the new
IID_t_rtreturn type. - Integrated
pgr_maxWeightedMatchingusing theMAXWEIGHTEDMATCHINGcase. - Updated the enumeration,
get_name(), and function entry point to use the new process architecture. - Resolved merge conflicts and synchronized the changes with the latest branch.
- Opened Boost version PoC PR #634 to begin testing Boost compatibility in CI.
week 10
Dates: (July 27th – August 2nd)
Proposed:
- Fixing remaining bugs, test and documentation details
- Wiki page
- Improve the pgTap test suites for
pgr_maxWeightedMatching. - Rework
inner_query.pg,no_crash_test.pg, andtypes_check.pgto improve test structure and coverage. - Update the pgr_maxWeightedMatching documentation and rename the example images for clearer references.
- Reworked the
inner_query.pg,no_crash_test.pg, andtypes_check.pgtest suites to improve test structure and coverage for different inputs and function behaviour. - Updated the
pgr_maxWeightedMatchingdocumentation. - Renamed the example images to
mwm_graph.pngandmwm_result.pngfor clearer references.
week 9
Dates: (July 20th – July 26th)
Proposed:
- Developer and User’s Documentation
- Suitable Query using sample data on pgrouting documentation.
- Improve the
types_check.pgpgTap test for pgr_maxWeightedMatching. - Refine and validate the
pgr_maxWeightedMatchingimplementation. - Complete the mentor-assigned exercise to remove redundant files from the GSoC branches and prepare them for future merging with the main pgRouting develop branch.
- Improved the
types_check.pgpgTap test. - Refined the
pgr_maxWeightedMatchingimplementation. - Removed redundant files from the GSoC branches as part of the mentor-assigned exercise, helping keep the branches clean and making future merging with the main pgRouting develop branch easier.
week 8
Dates: (July 13th – July 19th)
Proposed:
- Internal tests for
pgr_maximumWeightedMatching() - No server crash test
- pgtAP Unit tests
- Rewrite the
edge_cases.pgtests forpgr_maxWeightedMatching. - Test the updated edge cases and fix any issues.
- Rewrote the
edge_cases.pgtests forpgr_maxWeightedMatching. - Tested the updated edge cases and fixed the identified issues.
week 7
Dates: (July 6h – July 12th)
Proposed:
- Work on the feedback as provided from the First Evaluation
- Bug fixing
- Prepare second coding period Synopsis
- Add
pgr_maxWeightedMatchingto the documentation index and page history. - Update the release notes and NEWS to include
pgr_maxWeightedMatchingas a new experimental function. - Address documentation review comments.
- Added
pgr_maxWeightedMatchingto the documentation page history and availability list. - Updated
release_notes.rstand regeneratedNEWS.mdto includepgr_maxWeightedMatchingas a new experimental function. - Addressed mentor review comments and fixed the missing documentation entries.
week 6
Dates: (June 29th – July 5th)
Proposed:
- Finalize the function and documentation
- Prepare report for first evaluation
Plan:
- Add an additional example for
pgr_maxWeightedMatchingwith before/after graph illustrations. - Update the documentation, images, and supporting query/result files.
Report:
- Added an additional example with before/after graph images to
pgr_maxWeightedMatching. - Updated
pgr_maxWeightedMatching.rst,CMakeLists.txt, image files (before.png,after.png), and the correspondingmaxWeightedMatching.pgandmaxWeightedMatching.resultfiles.
week 5
Dates: (June 22nd – June 28th)
Proposed:
- Create sql query examples
- Prepare for midterm evaluation
Plan:
- Optimize and update the documentation for
pgr_maxWeightedMatching. - Improve and optimize the pgTAP unit tests (
edge_cases.pgandinner_query.pg).
Report:
- Optimized and updated the documentation for
pgr_maxWeightedMatching. - Improved and optimized the pgTAP unit tests (
edge_cases.pgandinner_query.pg).
week 4
Dates: (June 15th – June 21st)
Proposed:
- Finalize the data flow from SQL input to the C layer
- Write helper class and wrappers
- C driver to use Boost C++ function
Plan :
-
Implement and integrate
pgr_maxWeightedMatchinginto pgRouting. -
Add comprehensive pgTap tests (types_check.pg, inner_query.pg, no_crash_test.pg, and edge_cases.pg).
-
Update documentation queries and expected result files.
-
Improve reliability through automated testing and edge-case validation.
Report :
-
Successfully implemented and integrated
pgr_maxWeightedMatchingfor pgRouting. -
Wrote and executed comprehensive pgTap tests (types_check.pg, inner_query.pg, no_crash_test.pg, and edge_cases.pg), with all 74 tests passing.
-
Updated documentation queries and expected result files (
maxWeightedMatching.result). -
Enhanced reliability through edge-case validation, automated testing, and regression protection.
week 3
Dates: (June 8th – June 14th)
Proposed:
- Read data from User
- Start building the pipeline from SQL input to the C interface.
Plan:
-
Rename
maximumWeightedMatchingtomaxWeightedMatchingacross the project for consistent naming. -
Remove obsolete and duplicate files as part of the codebase cleanup.
-
Add the new
include/drivers/maxWeightedMatching_driver.hppdriver interface. -
Update shared enums and utility mappings to support the renamed function.
-
Reorganize related files to align with the updated project structure.
-
Fix license headers across the affected files to comply with project standards.
-
Update
CMakeLists.txtfiles to reflect the new structure.
Report:
-
Renamed
maximumWeightedMatchingtomaxWeightedMatchingacross the project for consistent naming. -
Removed obsolete and duplicate files as part of the codebase cleanup.
-
Added the new
include/drivers/maxWeightedMatching_driver.hppdriver interface. -
Updated shared enums and utility mappings to support the renamed function.
-
Reorganized related files to align with the updated project structure.
-
Fixed license headers across the affected files to comply with project standards.
-
Updated
CMakeLists.txtfiles to reflect the new structure.
week 2
Dates: (June 1st – June 7th)
Proposed:
- Set up the initial framework for tests and documentation.
- Start implementing
pgr_maximumWeightedMatching()
- Implement the initial
pgr_maxWeightedMatchingfunction and integrate it into the pgRouting source structure. - Add the required SQL interface, C/C++ driver, and process implementation.
- Set up the initial pgTAP test files for
pgr_maxWeightedMatching. - Add the initial documentation files, documentation queries, and required CMake entries.
- Set up the required directory structure and supporting files for the new function.
- Implemented the initial
pgr_maxWeightedMatchingfunction with the required C/C++ driver and process implementation. - Added the SQL interface and CMake configuration for the new function.
- Created the initial pgTAP test files for
pgr_maxWeightedMatching. - Added the initial documentation and documentation query files.
- Set up the required directory structure and supporting files for the new function.
week 1
Dates: (May 25th – May 31th)
Proposed:
- Go through BGL concepts
- Design data structures needed for
pgr_maximumWeightedMatching()
Plan:
-
Create foundational file structure for
pgr_maximumWeightedMatching -
Create initial C++ implementation skeleton
-
sql/max_flow/_maximumWeightedMatching.sql
-
sql/max_flow/maximumWeightedMatching.sql
-
include/drivers/max_flow/maximum_weighted_matching_driver.h
-
include/max_flow/maximumWeightedMatching.hpp
-
src/max_flow/maximumWeighted_matching_driver.cpp
-
src/max_flow/maximumWeightedMatching.c
-
src/max_flow/maximumWeightedMatching_process.cpp
Report:
-
Create foundational file structure for
pgr_maximumWeightedMatching -
Added basic structure of the following files:-
-
sql/max_flow/_maximumWeightedMatching.sql
-
sql/max_flow/maximumWeightedMatching.sql
-
include/drivers/max_flow/maximum_weighted_matching_driver.h
-
include/max_flow/maximumWeightedMatching.hpp
-
src/max_flow/maximumWeighted_matching_driver.cpp
-
src/max_flow/maximumWeightedMatching.c
-
src/max_flow/maximumWeightedMatching_process.cpp
Bonding period
- Introduce myself to the pgRouting mentors and community members.
- Set up my local development environment and tools.
- Get familiar with the pgRouting codebase and how development is done.
- Learn pgTap and the Boost C++ Libraries to support the project work.
- Create a wiki page to track weekly progress and updates.
- Take part in community chats, meetings, and discussions.
- Learn how PostgreSQL and PostGIS are used with pgRouting.
Proposed: Community bonding and initial preparation — introduce myself to the pgRouting mentors and community members, participate in discussions, and prepare the wiki page for tracking progress.
Plan for the week:
- Introduce myself to the pgRouting mentors and community members
- Participate in community chats, meetings, and discussions
- Create a wiki page to track weekly progress and updates
- Understand the project goals and workflow
Report:
- Participated in bonding period meetings
- Introduced myself to mentors and community members
- Prepared the wiki progress page
- Discussed project ideas and proposal with mentors
Proposed: Environment setup and codebase exploration — set up the local development environment, build pgRouting from source, and understand the project structure and workflow.
Plan for the week:
- Set up the local development environment and required tools
- Build pgRouting from source
- Explore the pgRouting codebase structure
- Understand the development workflow and build system
Report:
- Local development environment successfully configured
- Built pgRouting from source
- Studied the pgRouting codebase and workflow
- Explored the project structure and build process
Proposed: Technical preparation for the project — study Boost Graph Library concepts related to Maximum Weighted Matching and discuss implementation ideas with mentors.
Plan for the week:
- Study Boost Graph Library (BGL) concepts related to Maximum Weighted Matching
- Discuss implementation details and proposal ideas with mentors
- Learn basics of pgTap testing framework
- Study PostgreSQL and PostGIS integration with pgRouting
Report:
- Discussed project proposal and implementation ideas with mentors
- Studied BGL concepts for Maximum Weighted Matching
- Learned basics of pgTap testing framework
- Studied PostgreSQL and PostGIS integration with pgRouting
Link to all the Pull Requests made in GSoC-pgRouting repository
| Pull Request | Description | Date | Status |
|---|---|---|---|
| # 562 | GSoC-2026 Week-01: pgr_maximumWeightedMatching | June 1st, 2026 | Merged |
| # 565 | GSoC-2026 Week-02: pgr_maximumWeightedMatching | June 7th, 2026 | Closed |
| # 566 | GSoC-2026 Week-02: pgr_maximumWeightedMatching | June 8th, 2026 | Merged |
| # 569 | GSoC-2026 Week-03: pgr_maximumWeightedMatching | June 8th, 2026 | Closed |
| # 572 | GSoC-2026 Week-03: pgr_maximumWeightedMatching | June 14th, 2026 | Merged |
| # 575 | GSoC-2026 Week-04: pgr_maximumWeightedMatching | June 22th, 2026 | Merged |
| # 582 | GSoC-2026 Week-05: pgr_maximumWeightedMatching | June 28th, 2026 | Merged |
| # 589 | GSoC-2026 Week-06: pgr_maximumWeightedMatching | July 5th, 2026 | Merged |
| # 594 | GSoC-2026 Week-07: pgr_maximumWeightedMatching | July 13th, 2026 | Merged |
| # 599 | GSoC-2026 Week-08: pgr_maximumWeightedMatching | July 21th, 2026 | Merged |
| # 608 | GSoC-2026 Week-09: pgr_maximumWeightedMatching | July 24th, 2026 | Closed |
| # 609 | GSoC-2026 Week-09: pgr_maximumWeightedMatching | July 24th, 2026 | Merged |
| # 618 | GSoC-2026 Week-09: Exercise | August 4th, 2026 | Merged |
| # 617 | GSoC-2026 Week-10: pgr_maximumWeightedMatching | August 4th, 2026 | Merged |
| # 622 | GSoC-2026 Week-11: pgr_maximumWeightedMatching | August 15th,2026 | Merged |
| # 634 | Boost version : pgr_maximumWeightedMatching | August 17th,2026 | Closed |
| # 635 | GSoC-2026 Week-12: pgr_maximumWeightedMatching | August 17th,2026 | Merged |
Report Mail - [OSGeo Discourse]
Hello everyone,
With GSoC coming to an end, I hereby present my final report of the work I have done over the past three months. It has been an amazing learning experience and a great time working with the pgRouting community and mentors.
Title: Implementing Maximum Weighted Matching Algorithm to pgRouting from the Boost Graph Library
Organisation: pgRouting under the umbrella of OSGeo
Abstract: This GSoC project dealt with the implementation of one new graph algorithm in pgRouting. The algorithm is described below:
- Maximum Weighted Matching: It is an algorithm that finds a matching in an undirected graph with the maximum possible total edge weight, where no two selected edges share a common vertex. The implementation uses the Boost Graph Library’s maximum weighted matching algorithm and returns the selected matching edges along with their associated costs. The algorithm has a time complexity of O(V³) and a space complexity of O(V + E), where V is the number of vertices and E is the number of edges. This addition enhances pgRouting’s capabilities for solving weighted graph matching and optimization problems.
It is implemented in Boost Graph Library (BGL) as boost::maximum_weighted_matching
State of the Project Before GSoC: pgRouting did not have a Maximum Weighted Matching algorithm implemented. The project lacked a built-in function for finding a maximum_weighted_matching in an undirected graph.
State of the Project After GSoC: The deliverables include the implementation of pgr_maxWeightedMatching, along with its documentation, documentation tests, and pgTAP tests. The new function provides maximum weighted matching capabilities within pgRouting.
Potential Future Work:
- Continue improving
pgr_maxWeightedMatching()by addressing potential bugs, edge cases, and usability issues identified through community feedback and extended testing. - Explore optimizations to improve the algorithm’s performance and memory usage for larger graphs.
- Investigate support for additional graph configurations and matching use cases to expand the applicability of
pgr_maxWeightedMatching(). - Explore parallel or performance-oriented improvements where applicable to make weighted matching more efficient for large-scale graph processing.
Links:
-
Final Pull Requests:
- (#3139) Experimental Function - pgr_maxWeightedMatching
- Intermediate Pull Requests: https://github.com/pgRouting/GSoC-pgRouting/pulls?q=is%3Apr+author%3Amayurgalhate+
- Project Documentation (Wiki Page): (https://github.com/pgRouting/pgrouting/wiki/GSoC-2026-Maximum-Weighted-Matching-Algorithm)
I am so grateful to be a part of the amazing GSoC and OSGeo communities. I have learned a massive amount during this program, which has helped me improve my C++ architecture skills, my understanding of the Boost Graph Library, and how to effectively contribute to open source. Last but not least, a huge thank you to my mentors and the entire community for the continuous support, guidance, and helpful communication!
Thank you and Regards,
Mayur Galhate
- https://www.boost.org/doc/libs/latest/libs/graph/doc/html/graph/algorithms/network_flow/maximum_weighted_matching.html
- https://www.boost.org/doc/libs/latest/libs/graph/doc/html/graph/algorithms/network_flow/maximum_weighted_matching.html#_example
- https://www.boost.org/doc/libs/latest/libs/graph/doc/html/graph/index.html
- https://en.wikipedia.org/wiki/Maximum-weight_matching
- https://docs.pgrouting.org/latest/en/sampledata.html
- https://github.com/pgRouting/pgrouting