es
in the same subset?var s = new DisjointSet[Int]
s.add_all([1,2,3,4,5,6])
s.union_all([1,2,3])
assert not s.all_in_same_subset([2,3,4])
s.union_all([1,4,5])
assert s.all_in_same_subset([2,3,4])
# Are all elements of `es` in the same subset?
#
# var s = new DisjointSet[Int]
# s.add_all([1,2,3,4,5,6])
# s.union_all([1,2,3])
# assert not s.all_in_same_subset([2,3,4])
# s.union_all([1,4,5])
# assert s.all_in_same_subset([2,3,4])
fun all_in_same_subset(es: Collection[E]): Bool
do
if es.is_empty then return true
var nf = find(es.first)
for e in es do
var ne = find(e)
if ne != nf then return false
end
return true
end
lib/core/collection/union_find.nit:142,2--159,4