GSoC 2026 Maximum Weighted Matching Algorithm - pgRouting/pgrouting GitHub Wiki

Table of Contents

Proposal

Brief Description

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.

State of the Project Before GSoC

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.

Deliverables

  • 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.

Detailed Proposal

Detailed Proposal link

Participants

Title GitHub Handle Name
1st Mentor @krashish8 Ashish Kumar
2nd Mentor @cvvergara Vicky Vergara
Student Developer @mayurgalhate Mayur Galhate

Timeline & weekly report

Note: in reverse order: the most recent is first

Second Coding Period

week 12

Week 12

Dates: (August 10th – August 16th)

Proposed:

  • Prepare and submit the final project report.

Plan:

  1. Raise the issue and submit the final PR to the pgRouting/pgrouting repository targeting the develop branch.
  2. Add my name to doc/src/pgRouting-introduction.rst.
  3. Update doc/src/release_notes.rst with the relevant changes for pgr_maxWeightedMatching.
  4. Complete the final documentation and cleanup changes before submitting the PR.

Report:

  • Raised the issue and submitted the final PR to the pgRouting/pgrouting repository targeting the develop branch.
  • Added my name to doc/src/pgRouting-introduction.rst.
  • Updated doc/src/release_notes.rst with the relevant changes for pgr_maxWeightedMatching.
  • Completed the final documentation and cleanup changes before submitting the PR.

Link to report mail

week 11

Week 11

Dates: (August 3rd – August 9th)

Proposed:

  • Preparing for Final Delivery
  • Integrating to develop branch in the main repository

Plan:

  1. Check the existing process/driver options for pgr_maxWeightedMatching and determine whether one supports the IID_t_rt return type.
  2. Since no existing process/driver fits IID_t_rt, create the required process and driver files for the new return type.
  3. Add pgr_maxWeightedMatching to the new process/driver using the MAXWEIGHTEDMATCHING case.
  4. Update the enumeration, get_name(), and function entry point to use the new process architecture.
  5. Resolve merge conflicts and synchronize the changes with the latest branch.
  6. Open a Boost version proof-of-concept PR to begin testing Boost compatibility in CI.

Report:

  • Checked the existing process/driver options and confirmed that none supported the IID_t_rt return type required by pgr_maxWeightedMatching.
  • Created the required process and driver files for the new IID_t_rt return type.
  • Integrated pgr_maxWeightedMatching using the MAXWEIGHTEDMATCHING case.
  • 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.

Link to report mail

week 10

Week 10

Dates: (July 27th – August 2nd)

Proposed:

  • Fixing remaining bugs, test and documentation details
  • Wiki page

Plan:

  • Improve the pgTap test suites for pgr_maxWeightedMatching.
  • Rework inner_query.pg , no_crash_test.pg , and types_check.pg to improve test structure and coverage.
  • Update the pgr_maxWeightedMatching documentation and rename the example images for clearer references.

Report:

  • Reworked the inner_query.pg , no_crash_test.pg , and types_check.pg test suites to improve test structure and coverage for different inputs and function behaviour.
  • Updated the pgr_maxWeightedMatching documentation.
  • Renamed the example images to mwm_graph.png and mwm_result.png for clearer references.

Link to report mail

week 9

Week 9

Dates: (July 20th – July 26th)

Proposed:

  • Developer and User’s Documentation
  • Suitable Query using sample data on pgrouting documentation.

Plan:

  • Improve the types_check.pg pgTap test for pgr_maxWeightedMatching.
  • Refine and validate the pgr_maxWeightedMatching implementation.
  • 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.

Report:

  • Improved the types_check.pg pgTap test.
  • Refined the pgr_maxWeightedMatching implementation.
  • 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.

Link to report mail

week 8

Week 8

Dates: (July 13th – July 19th)

Proposed:

  • Internal tests for pgr_maximumWeightedMatching()
  • No server crash test
  • pgtAP Unit tests

Plan:

  • Rewrite the edge_cases.pg tests for pgr_maxWeightedMatching.
  • Test the updated edge cases and fix any issues.

Report:

  • Rewrote the edge_cases.pg tests for pgr_maxWeightedMatching.
  • Tested the updated edge cases and fixed the identified issues.

Link to report mail

week 7

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

Plan:

  • Add pgr_maxWeightedMatching to the documentation index and page history.
  • Update the release notes and NEWS to include pgr_maxWeightedMatching as a new experimental function.
  • Address documentation review comments.

Report:

  • Added pgr_maxWeightedMatching to the documentation page history and availability list.
  • Updated release_notes.rst and regenerated NEWS.md to include pgr_maxWeightedMatching as a new experimental function.
  • Addressed mentor review comments and fixed the missing documentation entries.

Link to report mail

First Coding Period

week 6

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_maxWeightedMatching with 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 corresponding maxWeightedMatching.pg and maxWeightedMatching.result files.

Link to report mail

week 5

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.pg and inner_query.pg).

Report:

  • Optimized and updated the documentation for pgr_maxWeightedMatching.
  • Improved and optimized the pgTAP unit tests (edge_cases.pg and inner_query.pg).

Link to report mail

week 4

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_maxWeightedMatching into 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_maxWeightedMatching for 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.

Link to report mail

week 3

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 maximumWeightedMatching to maxWeightedMatching across the project for consistent naming.

  • Remove obsolete and duplicate files as part of the codebase cleanup.

  • Add the new include/drivers/maxWeightedMatching_driver.hpp driver 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.txt files to reflect the new structure.

Report:

  • Renamed maximumWeightedMatching to maxWeightedMatching across the project for consistent naming.

  • Removed obsolete and duplicate files as part of the codebase cleanup.

  • Added the new include/drivers/maxWeightedMatching_driver.hpp driver 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.txt files to reflect the new structure.

Link to report mail

week 2

Week 2

Dates: (June 1st – June 7th)

Proposed:

  • Set up the initial framework for tests and documentation.
  • Start implementing pgr_maximumWeightedMatching()

Plan:

  1. Implement the initial pgr_maxWeightedMatching function and integrate it into the pgRouting source structure.
  2. Add the required SQL interface, C/C++ driver, and process implementation.
  3. Set up the initial pgTAP test files for pgr_maxWeightedMatching.
  4. Add the initial documentation files, documentation queries, and required CMake entries.
  5. Set up the required directory structure and supporting files for the new function.

Report:

  • Implemented the initial pgr_maxWeightedMatching function 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.

Link to report mail

week 1

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

Link to report mail

Community Bonding Period

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.

Week -1 (May 1 ~ May 10)

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

Link to report mail

Week -2 (May 11 ~ May 18)

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

Link to report mail

Week -3 (May 19 ~ May 24)

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 report mail

Log of Pull Requests

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

Final Report

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:

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

References

⚠️ **GitHub.com Fallback** ⚠️