-
-
Notifications
You must be signed in to change notification settings - Fork 376
GSoC 2021 Implement Edge Coloring Algorithm for pgRouting by the Boost Graph Library
- Proposal
- Participants
- Timeline
- Log of Pull Requests
- Weekly Reports
- References
Edge Coloring is an algorithm used for coloring of the edges for the vertices in the graph. It is an assignment of colors to the edges of the graph so that no two adjacent edges have the same color.
If edges are ordered as e1, e2, ..., en it assigns colors c1, c2, ..., cn in such a way that no vertex connects with 2 edges of the same color.
It is used in several representations of real-world systems like traffic signalling, bi-processors, fiber-optic communication, etc. It can also tell us if a graph is Bipartite. It is implemented in Boost Graph Library (BGL) as Boost::Edge Coloring. It is applicable for undirected and loop-free (i.e no self-loops and no parallel edges) graph. It has a polynomial-time complexity of O(|E| |V|).
I propose to add the above algorithm into pgRouting during the GSoC period.
pgRouting currently does not have the proposed algorithm implemented.
Edge Coloring is not implemented before in pgRouting. The Sequential Vertex Coloring has been implemented in pgRouting during the GSoC 2020 period by Ashish Kumar. However, a single standard function does not exist for this coloring algorithm, besides it has various other applications apart from checking if a graph is Bipartite. Also, it helps complete the coloring algorithms part of the Boost Graph Library in pgRouting.
-
Adding Boost::Edge Coloring algorithm to pgRouting adds more functionality to it and helps future users and developers to use and integrate it with other routing algorithms. It allows access to the algorithm with a single function. It has applications in traffic signalling, scheduling problems, processors and in frequency assignment for fiber optic networks.
-
One of the benefits is, it can tell us whether a graph is Bipartite or not. If in a graph (G), the chromatic number χ′(G) i.e. minimum number of colors needed for proper edge coloring of G is equal to degree Δ(G) (largest number of edges incident to any single vertex) of the graph, (i.e. χ′(G) = Δ(G)) then G is said to be Bipartite.
-
One of the most useful real-world benefits is in fiber-optic communication, the Edge Coloring algorithm is the problem of assigning colors (frequencies of light) to pairs of nodes (edges) that wish to communicate with each other, and paths through a fiber-optic communications network for each pair, subject to the restriction that no two paths that share a segment of fiber use the same frequency (color) as each other.
To provide users of pgRouting more functionality I am going to implement this algorithm from Boost Graph Library (BGL). As due to new changes in GSoC this year the time has been reduced but if the time permits I intend to create lots of tests and implement more applications. All these algorithms and applications are helpful for future developers, users and development of pgRouting as a whole.
The deliverables for the proposal would be:
- Implementation of pgr_edgeColoring().
- SQL, C, C++ code related to the function.
- A wiki page for the project.
- User documentation.
- Example Query for the documentation.
- Basic pgTap tests.
- Report for evaluations.
Detailed Proposal in PDF format
| Title | GitHub Handle | Name |
|---|---|---|
| 1st Mentor | @dkastl | Daniel Kastl |
| 2nd Mentor | @ashrafroni | Ashraf Hossain |
| 3rd Mentor | @rahulworld | Rahul Chauhan |
| Student Developer | @Veenits123 | Veenit Kumar |
- Set up the development environment.
- Interact with mentors, introduce myself to the community, and actively get involved in the discussion.
- Get familiar with pgRouting’s development style. Understand expected coding, documentation, and testing standards set by pgRouting.
- Set up a wiki page to keep track of weekly progress.
- Develop a better understanding of PostgreSQL, PostGIS, Pl/pgSQL, and how they interact with pgRouting.
- Learn to create unit tests using pgTap.
- Implement simple dummy functions to better understand pgRouting.
- Design
pgr_edgeColoring()function. - Create a basic skeleton for documentation and tests.
- Create code skeleton of SQL and C code which allows the C++ implementation of the function to work with PostgreSQL.
- Design the detailed signature for the
pgr_edgeColoring()function. - Go through the Boost related work in pgRouting for a better understanding and skills on the implementation.
- Implement
pgr_edgeColoring()function along with its helper files.
- Read data from PostgreSQL.
- Transfer data to C++ containers suitable for use with Boost Graph Library.
- Create the necessary class wrapper for the Boost function.
- Process the data with the Boost Function.
- Transform result to C containers suitable for executing with PostgreSQL queries.
- Prepare user documentation.
- Create suitable queries using the sample data provided on pgRouting documentation.
- Work on the submissions required as part of the first evaluation.
- Prepare the First Coding Period report.
- Work on the feedback as provided from the First Evaluation.
- Finalize the above coding part (if remaining) to get an overall solution.
- Prepare Second Coding Period synopsis.
- Prepare a basic outline and framework for the pgTap tests.
- Create units and internal tests for the
pgr_edgeColoring()function.- Create pgTap tests to check no server crash.
- Create pgTap unit tests for expected results for different small graphs:
- One vertex graph.
- One edge graph.
- Two edge graph.
- Cyclic graph with 3 edges.
- Test all the critical edge cases.
- Fix bugs if found (any).
- Fix all the bugs and documentation details.
- Review, complete and finalize all the tests and documentation for all the functions implemented.
- Integration to the
developbranch in the main repository of pgRouting.
- Prepare final submission along with final user documentation.
- Create a detailed final report.
Link to all the Pull Requests made in GSoC-pgRouting repository for GSoC 2021
| Pull Request | Description | Date | Status |
|---|---|---|---|
| #142 | GSoC-2021 Week1: pgr_edgeColoring | June 12th, 2021 | Merged |
| #142 | Task 2: Experience with GitHub & Git | February 9th, 2021 | GSoC Task Pull Request - Not to Merge |
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Started working on the
pgr_edgeColoringfunction. - Dummy placements of all the files that I need to create during the GSoC period.
- Checked the code after committing using command:
bash tools/scripts/code_checker.sh coloring - Updated
CMakeLists.txtforsql, src, doc, docqueriesfiles. - Learned about
license_check,News_check,shell_check,signature_check, etc. - Learned how to use terminal and GitHub Action to check the error while building files.
- Made a pull request with all these changes (#169).
- Started working on the
-
What do I plan on doing next week?
- Fix all the Bugs and Errors getting on the building and compiling of files during Week-1.
- Design
boost::edge_coloring(). - Create the necessary class wrapper for the Boost function.
- Process the data with the Boost Function.
-
Am I blocked on anything?
- No, I have no issues.
-
Introductory Mail - [SoC], [pgrouting-dev]
-
Commmunity Bonding Period Report Mail - [SoC], [pgrouting-dev]
- Set up the development environment.
- Interact with mentors, introduce myself to the community, and actively get involved in the discussion.
- Set up a wiki page to keep track of weekly progress.
- Add a wiki link to OSGeo's accepted student's wiki page.
- Studied GSoC students guide and the OSGeo recommendations for students.
- Introduce myself and my project on OSGeo's SOC and pgrouting-dev mailing list.
- Get familiar with pgRouting’s development style. Understand expected coding, documentation, and testing standards set by pgRouting.
- Develop a better understanding of PostgreSQL, PostGIS, Pl/pgSQL, and how they interact with pgRouting.
- Learn to create unit tests using pgTAP.
- Created a public repository
GSoC-pgRoutingwhere all my works are reflected in the GSoC period. - Learned how and where to create Pull Request, merge and how to commit, etc.
- Created a new branch named
veenit-2021in the GSoC-pgRouting repository, where I will be merging all the Pull Requests.
-
May 21st
- Introduction meeting with the mentors.
- Discussion on the future plans of the GSoC period.
-
May 28th
- Cancelled due to Cyclone in my area.
-
June 1st
- Basic Repository preparation of pgRouting.
- Understood the files and structures:
sql, src, include, pgtap, doc, docqueriesof various functions. - Understood and analyzed the coding style of
pgr_dijkstra,pgr_bdDijkstra,pgr_bipartite, etc.
-
June 4th
- Learned how to design the functions, create various tests, run tests, etc.
- Understood how is a test designed and how to do the testing using pgTAP like types-check, inner-query, no-crash-test, edge-cases.
- Understood the development and coding style of C++, SQL and C files of the functions.
- Learned how and where to create Pull Request, how to commit, etc.
-
June 11th
- Checked the code after committing using command:
bash tools/scripts/code_checker.sh - Learned about
license_check,News_check,shell_check,signature_check, etc. - Learned how to use terminal and GitHub Action to check the error while building files.
- Checked the code after committing using command:
-
Proposal Mail - [SoC], [pgrouting-dev]
- Misra & Gries Edge Coloring Algorithm https://en.wikipedia.org/wiki/Misra_%26_Gries_edge_coloring_algorithm
- Edge Coloring https://en.wikipedia.org/wiki/Edge_coloring
- https://www.cs.utexas.edu/users/misra/psp.dir/vizing.pdf Misra, Jayadev; Gries, David(1992). "A constructive proof of Vizing's theorem"
- https://github.com/pgRouting/pgrouting/tree/master
- https://github.com/pgRouting/pgrouting/tree/develop
- Graph Coloring https://en.wikipedia.org/wiki/Graph_coloring
- Graph Bandwidth https://en.wikipedia.org/wiki/Graph_bandwidth
- https://codeforces.com/blog/entry/75431 Story about Edge Coloring of Graph
- pgRouting queries on Stack Overflow https://stackoverflow.com/search?q=pgrouting
- pgRouting GSoC Ideas: 2021 https://github.com/pgRouting/pgrouting/wiki/GSoC-Ideas:-2021
- https://github.com/pgRouting/GSoC-pgRouting/wiki/Creating-a-GSoC-schedule
- pgRouting Workshop https://workshop.pgrouting.org/2.6/en/index.html
- https://docs.pgrouting.org/3.2/en/genindex.html pgRouting Documentation
- MIT 6.042J Mathematics for Computer Science, Fall 2010 http://www.youtube.com/watch?v=h9wxtqoa1jY
- https://www.youtube.com/watch?v=_3-XbvYqMEo 2019 - Shortest path in the database and more with pgRouting
- Google Summer of Code Recommendations for Students https://wiki.osgeo.org/wiki/Google_Summer_of_Code_Recommendations_for_Students
- https://www.openstreetmap.org/ OpenStreetMap