Skip to content

Commit be89ee8

Browse files
amontoisongdalle
andcommitted
Apply suggestions from code review
Co-authored-by: Guillaume Dalle <22795598+gdalle@users.noreply.github.com>
1 parent cfddfd3 commit be89ee8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/forest.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ function Base.push!(forest::Forest{T}, edge::Tuple{T,T}) where {T<:Integer}
2020
forest.counter += 1
2121
forest.intmap[edge] = forest.counter
2222
forest.ntrees += one(T)
23-
return edge
23+
return forest
2424
end
2525

2626
function _find_root!(parents::Vector{T}, index_edge::T) where {T<:Integer}
27-
@inbounds p = parents[index_edge]
28-
@inbounds if parents[p] != p
27+
p = parents[index_edge]
28+
if parents[p] != p
2929
parents[index_edge] = p = _find_root!(parents, p)
3030
end
3131
return p
@@ -38,15 +38,15 @@ end
3838
function root_union!(forest::Forest{T}, index_edge1::T, index_edge2::T) where {T<:Integer}
3939
parents = forest.parents
4040
rks = forest.ranks
41-
@inbounds rank1 = rks[index_edge1]
42-
@inbounds rank2 = rks[index_edge2]
41+
rank1 = rks[index_edge1]
42+
rank2 = rks[index_edge2]
4343

4444
if rank1 < rank2
4545
index_edge1, index_edge2 = index_edge2, index_edge1
4646
elseif rank1 == rank2
4747
rks[index_edge1] += one(T)
4848
end
49-
@inbounds parents[index_edge2] = index_edge1
49+
parents[index_edge2] = index_edge1
5050
forest.ntrees -= one(T)
5151
return nothing
5252
end

0 commit comments

Comments
 (0)