DataStructures.jl
DataStructures.jl copied to clipboard
Allow passing arbitrary Integers to methods for IntDisjointSets
I noticed that some methods for IntDisjointSets are defined such that they only allow the exact eltype as parameter, for example
"""
in_same_set(s::IntDisjointSet{T}, x::T, y::T)
Returns `true` if `x` and `y` belong to the same subset in `s`, and `false` otherwise.
"""
in_same_set(s::IntDisjointSet{T}, x::T, y::T) where {T<:Integer} = find_root!(s, x) == find_root!(s, y)
Would be a good idea to change these methods to something like
in_same_set(s::IntDisjointSet{T}, x::Integer, y::Integer) where {T<:Integer} = find_root!(s, T(x)) == find_root!(s, T(y))
?
yes, it would