-
Couldn't load subscription status.
- Fork 6
Revisit the post-processing #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #267 +/- ##
===========================================
- Coverage 100.00% 99.11% -0.89%
===========================================
Files 17 18 +1
Lines 1962 2156 +194
===========================================
+ Hits 1962 2137 +175
- Misses 0 19 +19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/coloring.jl
Outdated
| # The hub of this trivial star is still unknown | ||
| if h < 0 | ||
| if neutralized_first == :rows | ||
| # j represents a column in the context of bicoloring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only use neutralized_first in the context of bicoloring for now. In the general symmetric case, the ranking of i with respect to j has no real meaning, and while I know that we have been using max(i, j) as a default, maybe it is time to change it? My suggestion: since vertices_in_order sorts vertices from hardest to easiest, we probably want to set color_used to true on the hardest ones first, so we could compare the rank of i and j in vertices_in_order to decide? That would also be a decent heuristic in the bicoloring case whenever we want to minimize the sum ncolors_row + ncolors_col, in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only use
neutralized_firstin the context of bicoloring for now.
I agree 👍
In the general symmetric case, the ranking of
iwith respect tojhas no real meaning, and while I know that we have been usingmax(i, j)as a default, maybe it is time to change it?
Yes, I also agree.
Maybe we can find a parameter similar to neutralized_first to specify which quantity we want to minimize during post-processing:
- Total number of colors (default)
- number of row colors (only for bicoloring)
- number of column colors (only for bicoloring)
My suggestion: since
vertices_in_ordersorts vertices from hardest to easiest, we probably want to setcolor_usedtotrueon the hardest ones first, so we could compare the rank ofiandjinvertices_in_orderto decide? That would also be a decent heuristic in the bicoloring case whenever we want to minimize the sumncolors_row + ncolors_col, in my opinion.
I don't think that using vertices_in_order is really relevant here because it was computed for the "full initial graph" on which we do the (bi)coloring and not for the "reduced graph" that only contains the trivial stars with unknown hubs.
It is still a valid heuristic but we can be smarter.
I think I have the optimal solution for minimizing the sum ncolors_row + ncolors_col (in the post-processing).
I will try to explain it in #264 and justify why it is optimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can find a parameter similar to neutralized_first to specify which quantity we want to minimize during post-processing
Something like postprocessing_minimizes = :all_colors / :row_colors / :column_colors? With the assumption that the last two settings fall back on :all_colors whenever we're in the unidirectional case.
With that parameter, we don't need neutralize_first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but how do we specify that is a unidirectional case? Shoud we add a boolean argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can do that.
When thinking about the natural order variants for bicoloring I found myself forced to pass around the original shape of A (in addition to the adjacency graph of the possibly augmented A), so that's another option
|
Also, how does this all generalize to the acyclic bicoloring? |
It is exactly the same in terms of handling trivial edges. It was just late yesterday, and I didn’t find the energy to finalize the PR. |
0831073 to
6134b6b
Compare
6134b6b to
126f4bb
Compare
|
@gdalle I have an issue in my new function |
|
We could store this information in the adjacency graph, to know whether it comes from a symmetric matrix or not, and in the latter case have access to the row/column split |
|
Or we pass an additional argument to the coloring |
I prefer this approach because we can know that we have "augmented adjacency matrix" this way, and thus know that we are in bicoloring context for the function I will not need to pass the boolean parameter |
|
I suggest replacing struct AdjacencyGraph{T<:Integer,bicoloring}
S::SparsityPatternCSC{T}
edge_to_index::Vector{T}
original_size::Tuple{Int,Int}
endWe no longer need |
Ok for me 👍
Yes but we don't have I think adding a field |
|
Fair point 👍 |
Related to #264
Guillaume, it is still a draft but you can already have a look.