Skip to content

Commit 8b18bfd

Browse files
authored
Add a default value for postprocessing (#218)
* Add a default value for postprocessing * Update coloring.jl * Find a better solution for Guillaume * suitesparse.jl
1 parent b33d436 commit 8b18bfd

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/coloring.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function partial_distance2_coloring!(
5454
end
5555

5656
"""
57-
star_coloring(g::AdjacencyGraph, order::AbstractOrder; postprocessing::Bool)
57+
star_coloring(g::AdjacencyGraph, order::AbstractOrder, postprocessing::Bool)
5858
5959
Compute a star coloring of all vertices in the adjacency graph `g` and return a tuple `(color, star_set)`, where
6060
@@ -76,7 +76,7 @@ If `postprocessing=true`, some colors might be replaced with `0` (the "neutral"
7676
7777
> [_New Acyclic and Star Coloring Algorithms with Application to Computing Hessians_](https://epubs.siam.org/doi/abs/10.1137/050639879), Gebremedhin et al. (2007), Algorithm 4.1
7878
"""
79-
function star_coloring(g::AdjacencyGraph, order::AbstractOrder; postprocessing::Bool)
79+
function star_coloring(g::AdjacencyGraph, order::AbstractOrder, postprocessing::Bool)
8080
# Initialize data structures
8181
nv = nb_vertices(g)
8282
ne = nb_edges(g)
@@ -272,7 +272,7 @@ function symmetric_coefficient(
272272
end
273273

274274
"""
275-
acyclic_coloring(g::AdjacencyGraph, order::AbstractOrder; postprocessing::Bool)
275+
acyclic_coloring(g::AdjacencyGraph, order::AbstractOrder, postprocessing::Bool)
276276
277277
Compute an acyclic coloring of all vertices in the adjacency graph `g` and return a tuple `(color, tree_set)`, where
278278
@@ -294,7 +294,7 @@ If `postprocessing=true`, some colors might be replaced with `0` (the "neutral"
294294
295295
> [_New Acyclic and Star Coloring Algorithms with Application to Computing Hessians_](https://epubs.siam.org/doi/abs/10.1137/050639879), Gebremedhin et al. (2007), Algorithm 3.1
296296
"""
297-
function acyclic_coloring(g::AdjacencyGraph, order::AbstractOrder; postprocessing::Bool)
297+
function acyclic_coloring(g::AdjacencyGraph, order::AbstractOrder, postprocessing::Bool)
298298
# Initialize data structures
299299
nv = nb_vertices(g)
300300
ne = nb_edges(g)

src/interface.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ function _coloring(
266266
symmetric_pattern::Bool,
267267
)
268268
ag = AdjacencyGraph(A)
269-
color, star_set = star_coloring(ag, algo.order; postprocessing=algo.postprocessing)
269+
color, star_set = star_coloring(ag, algo.order, algo.postprocessing)
270270
if speed_setting isa WithResult
271271
return StarSetColoringResult(A, ag, color, star_set)
272272
else
@@ -283,7 +283,7 @@ function _coloring(
283283
symmetric_pattern::Bool,
284284
) where {R}
285285
ag = AdjacencyGraph(A)
286-
color, tree_set = acyclic_coloring(ag, algo.order; postprocessing=algo.postprocessing)
286+
color, tree_set = acyclic_coloring(ag, algo.order, algo.postprocessing)
287287
if speed_setting isa WithResult
288288
return TreeSetColoringResult(A, ag, color, tree_set, R)
289289
else
@@ -301,7 +301,7 @@ function _coloring(
301301
) where {R}
302302
A_and_Aᵀ = bidirectional_pattern(A; symmetric_pattern)
303303
ag = AdjacencyGraph(A_and_Aᵀ; has_diagonal=false)
304-
color, star_set = star_coloring(ag, algo.order; postprocessing=algo.postprocessing)
304+
color, star_set = star_coloring(ag, algo.order, algo.postprocessing)
305305
if speed_setting isa WithResult
306306
symmetric_result = StarSetColoringResult(A_and_Aᵀ, ag, color, star_set)
307307
return BicoloringResult(A, ag, symmetric_result, R)
@@ -321,7 +321,7 @@ function _coloring(
321321
) where {R}
322322
A_and_Aᵀ = bidirectional_pattern(A; symmetric_pattern)
323323
ag = AdjacencyGraph(A_and_Aᵀ; has_diagonal=false)
324-
color, tree_set = acyclic_coloring(ag, algo.order; postprocessing=algo.postprocessing)
324+
color, tree_set = acyclic_coloring(ag, algo.order, algo.postprocessing)
325325
if speed_setting isa WithResult
326326
symmetric_result = TreeSetColoringResult(A_and_Aᵀ, ag, color, tree_set, R)
327327
return BicoloringResult(A, ag, symmetric_result, R)

test/suitesparse.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ what_table_41_42 = CSV.read(
9595
@test nb_edges(ag) == row[:E]
9696
@test maximum_degree(ag) == row[]
9797
@test minimum_degree(ag) == row[]
98-
color_N, _ = star_coloring(ag, NaturalOrder(); postprocessing=false)
98+
postprocessing = false
99+
color_N, _ = star_coloring(ag, NaturalOrder(), postprocessing)
99100
@test_skip row[:KS1] <= length(unique(color_N)) <= row[:KS2] # TODO: find better
100101
yield()
101102
end

0 commit comments

Comments
 (0)