Skip to content

Commit

Permalink
Update disjoint_set.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison authored Feb 14, 2025
1 parent 07d5bb1 commit 4dd340c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/disjoint_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ end
IntDisjointSet(n::T) where {T<:Integer} = IntDisjointSet{T}(collect(Base.OneTo(n)), zeros(T, n), n)
IntDisjointSet{T}(n::Integer) where {T<:Integer} = IntDisjointSet{T}(collect(Base.OneTo(T(n))), zeros(T, T(n)), T(n))
Base.length(s::IntDisjointSet) = length(s.parents)
function Base.sizehint!(s::IntDisjointSet, n::Integer)
sizehint!(s.parents, n)
sizehint!(s.ranks, n)
return s
end

"""
num_groups(s::IntDisjointSet)
Expand Down

0 comments on commit 4dd340c

Please sign in to comment.