Skip to content

Commit 0cdff00

Browse files
committed
Fix the tests
1 parent f006299 commit 0cdff00

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/coloring.jl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ function _grow_star!(
339339
if p != v # a neighbor of v with color[w] encountered for the first time
340340
first_neighbor[color[w]] = (v, w, index_vw)
341341
else # merge T_{vw} with a two-colored star being grown around v
342-
root1 = find_root!(forest, index_vw)
343-
root2 = find_root!(forest, index_pq)
344-
root_union!(forest, root1, root2)
342+
root_vw = find_root!(forest, index_vw)
343+
root_pq = find_root!(forest, index_pq)
344+
root_union!(forest, root_vw, root_pq)
345345
end
346346
return nothing
347347
end
@@ -356,10 +356,10 @@ function _merge_trees!(
356356
# modified
357357
forest::Forest{<:Integer},
358358
)
359-
root1 = find_root!(forest, index_vw)
360-
root2 = find_root!(forest, index_wx)
361-
if root1 != root2
362-
root_union!(forest, root1, root2)
359+
root_vw = find_root!(forest, index_vw)
360+
root_wx = find_root!(forest, index_wx)
361+
if root_vw != root_wx
362+
root_union!(forest, root_vw, root_wx)
363363
end
364364
return nothing
365365
end
@@ -482,7 +482,11 @@ function TreeSet(
482482

483483
# nvmax is the number of vertices in the largest tree of the forest
484484
# In a tree, the number of vertices is equal to the number of edges plus one
485-
nvmax = maximum(num_edges_per_tree) + 1
485+
nvmax = zero(T)
486+
for ne_tree in num_edges_per_tree
487+
nvmax = max(nvmax, ne_tree)
488+
end
489+
nvmax = nvmax + 1
486490

487491
# Create a queue with a fixed size nvmax
488492
queue = Vector{T}(undef, nvmax)

test/allocations.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,7 @@ end
154154
b64 = @b fast_coloring(A64, problem, algo)
155155
b32 = @b fast_coloring(A32, problem, algo)
156156
# check that we allocate no more than 50% + epsilon with Int32
157-
if decompression == :direct
158-
@test b32.bytes < 0.6 * b64.bytes
159-
else
160-
@test_broken b32.bytes < 0.6 * b64.bytes
161-
end
157+
@test b32.bytes < 0.6 * b64.bytes
162158
end
163159
end
164160
end;

0 commit comments

Comments
 (0)