Skip to content

Coloring one driver - #256

Closed
cvvergara wants to merge 22 commits into
developfrom
coloring-one-driver
Closed

Coloring one driver#256
cvvergara wants to merge 22 commits into
developfrom
coloring-one-driver

Conversation

@cvvergara

@cvvergara cvvergara commented Mar 24, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Updated edge coloring output values to reflect corrected algorithm results.
  • Tests

    • Refactored coloring algorithm test cases to align with updated expected outputs and support version-conditional assertions for compatibility.

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 052f028c-ec46-4d24-ae51-73a3b1e1926f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes refactor pgRouting's coloring algorithms from class-based drivers to a unified architecture with free functions, a shared Which enum selector, and centralized pgr_process_coloring entry point. Three algorithms—edge coloring, bipartite detection, and sequential vertex coloring—are consolidated into a consistent interface.

Changes

Cohort / File(s) Summary
Enum and Process/Driver Refactoring
include/c_common/enums.h, include/drivers/coloring_driver.hpp, include/process/coloring_process.h
Extended Which enum with EDGECOLORING, BIPARTITE, SEQUENTIAL enumerators; replaced sequential-specific sequentialVertexColoring_driver.h with unified coloring_driver.hpp accepting Which parameter; renamed/refactored edgeColoring_driver.hcoloring_process.h with new signature pgr_process_coloring(const char\*, enum Which, II_t_rt\*\*, size_t\*) removing three char\*\* output parameters.
Bipartite Header and Implementation
include/coloring/bipartite.hpp, src/coloring/bipartite.cpp, src/coloring/bipartite_driver.cpp, src/coloring/bipartite.c
Renamed bipartite_driver.hbipartite.hpp with new C++ API pgr_bipartite(pgrouting::UndirectedGraph&); removed old C linkage function; added implementation with Boost bipartite check and partition mapping; removed old driver implementation; refactored C wrapper to use shared pgr_process_coloring instead of per-algorithm driver.
Bipartite Header Cleanup
include/coloring/bipartite_driver.hpp
Entirely removed templated Pgr_Bipartite<G> class and its print_Bipartite/pgr_bipartite methods.
Edge Coloring Header and Implementation
include/coloring/edgeColoring.hpp, src/coloring/edgeColoring.cpp, src/coloring/edgeColoring_driver.cpp, src/coloring/edgeColoring.c
Removed Pgr_edgeColoring class; introduced free function edgeColoring(pgrouting::UndirectedGraph); rewrote implementation to use Boost graph directly instead of internal graph construction; removed old driver function; refactored C wrapper to call pgr_process_coloring(EDGECOLORING, ...) with adjusted SRF tuple construction from 3 to 2 fields.
Sequential Vertex Coloring Header and Implementation
include/coloring/sequentialVertexColoring.hpp, src/coloring/sequentialVertexColoring.cpp, src/coloring/sequentialVertexColoring_driver.cpp, src/coloring/sequentialVertexColoring.c
Removed templated Pgr_sequentialVertexColoring<G> class; added function-only declaration; new implementation using Boost sequential coloring with result conversion helper; removed old driver function; refactored C wrapper to use pgr_process_coloring(SEQUENTIAL, ...).
Unified Driver and Process Implementation
src/coloring/coloring_driver.cpp, src/coloring/coloring_process.cpp
New C++ driver do_coloring(...) dispatching on Which enum to one of three algorithms; new C process layer wrapping SPI lifecycle, timing, exception handling, and message reporting for unified coloring entry point.
Build Configuration
src/coloring/CMakeLists.txt
Removed *_driver.cpp sources; added consolidated bipartite.cpp, edgeColoring.cpp, sequentialVertexColoring.cpp, coloring_driver.cpp, coloring_process.cpp.
Test Suite Refactoring
pgtap/coloring/edgeColoring/edge_cases.pg
Reduced plan from 29 to 17 tests; refactored test setup from persistent tables to inline VALUES/FROM queries; simplified intermediate prepared statements; introduced version-conditional assertions using min_lib_version('4.1.0') for self-loop and multi-edge cases; updated expected color counts; changed edge color output from 3 to 2 fields.
Test Expected Output
docqueries/coloring/edgeColoring.result
Updated expected color for edge 1 from 3 to 1 reflecting algorithm/implementation changes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes


🐰 Three hopping-mad algorithms 🎨
Unified under one enum's call,
No more driver mess!
Free functions reign supreme,
Coloring dreams come true! 🌈

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch coloring-one-driver

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cvvergara

Copy link
Copy Markdown
Owner Author

@coderabbitai review
@coderabbitai summary

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown

@cvvergara: Sure! I'll regenerate the summary and kick off a fresh review of the PR.

✅ Actions performed

Summary regeneration triggered.

@cvvergara cvvergara closed this Jun 9, 2026
@cvvergara
cvvergara deleted the coloring-one-driver branch August 8, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant