Add canonical color refinement - #522
Open
Abdullah-Rady wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #522 +/- ##
==========================================
+ Coverage 97.46% 97.51% +0.05%
==========================================
Files 127 129 +2
Lines 7766 7943 +177
==========================================
+ Hits 7569 7746 +177
Misses 197 197 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
This PR adds canonical color refinement to Graphs.jl using the partition-refinement algorithm described by Berkholz, Bonsma, and Grohe.
Color refinement repeatedly splits color classes according to the number of neighbors each vertex has in every color class. When the refining color set is sufficient, the implementation returns a canonical coloring of the unique coarsest stable partition that refines the initial coloring.
Changes
canonical_color_refinement.color_refinementas a shorter alias.AbstractGraphwrapper types.Canonicality
The returned color numbers do not depend on vertex numbering.
For isomorphic graphs$G_1$ and $G_2$ , with isomorphism $\sigma$ , corresponding vertices receive the same output color:
When initial colorings are supplied, they must be transported by the same isomorphism:
Tests verify exact color-number preservation under vertex relabeling for both unit and nontrivial initial colorings.
Directed graphs
For directed graphs, color degrees count outgoing neighbors, following the reference's primary stability definition.
Testing
Reference
C. Berkholz, P. Bonsma, and M. Grohe,
Tight Lower and Upper Bounds for the Complexity of Canonical Colour Refinement
https://arxiv.org/abs/1509.08251