Repository navigation
Conversation
`GreedyColoringAlgorithm(order; recoloring_iterations=0)` improves the coloring of each order with passes of Culberson's iterated greedy algorithm: the vertices are recolored greedily in an order where the vertices of each color class are consecutive, which never increases the number of colors. The classes are ordered by decreasing color in odd passes and by decreasing size in even passes. This option only affects row and column colorings. Assisted-by: Claude Code (Opus 5.5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #344 +/- ##
==========================================
+ Coverage 99.17% 99.18% +0.01%
==========================================
Files 22 22
Lines 2304 2339 +35
==========================================
+ Hits 2285 2320 +35
Misses 19 19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Thanks! I'll take a look next week on my train to Germany |
vchuravy
marked this pull request as ready for review
October 10, 2026 14:30
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Culberson's iterated greedy recoloring as an option of
GreedyColoringAlgorithmfor:rowand:columncolorings:Each pass recolors the vertices greedily (
partial_distance2_coloring!) in an order where the vertices of each color class are consecutive. The vertices of a class are pairwise independent, so a pass never increases the number of colors (Culberson & Luo, 1996). The classes are ordered by decreasing color in odd passes and by decreasing size in even passes, so the result is deterministic. With a tuple of orders, each order's coloring is recolored before the best one is kept. The option is ignored for symmetric and bidirectional colorings, where a pass would also have to preserve the star/acyclic structure, and forforced_colors(ConstantColoringAlgorithm).Motivation: Ariadne.jl assembles sparse Jacobians by colored forward- or reverse-mode AD, one product per color, so every color costs one Jacobian-vector product per assembly. Number of column colors on this branch:
sprand(Bool, 2000, 2000, 0.003)On unstructured patterns, recoloring closes much of the gap. On the full patterns of structured discretizations, the greedy coloring is already a fixed point of the recoloring, with deterministic or random class orders. There, it pays off on the small conflict graph of a class-constrained (quotient) coloring (#345): 5 colors for the Laplacian and 80 for the DG-like pattern, both equal to the lower bound.
Cost: each pass costs about as much as one greedy coloring (for the DG-like pattern, 14400 columns: ~0.08 s per pass), so the default stays
0.Changes
src/coloring.jl:iterated_greedy_recoloring!(documented in the dev docs)src/interface.jl:recoloring_iterationskeyword (anArgumentErrorif negative), applied in the:columnand:row_coloringmethodsLocally on Julia 1.11:
order.jl,random.jl,type_stability.jl, JET, doctests and allocation tests pass. Aqua's persistent-tasks check fails in my environment onmaintoo.Draft: open for feedback on the API (a keyword of
GreedyColoringAlgorithmvs. a separate post-processing step, and the name).🤖 Generated with Claude Code