| 29 | /// if region is provided then only its elements will be checked |
| 30 | template <typename I> |
| 31 | [[nodiscard]] TypedBitSet<I> findComponentBitSet( BaseUnionFind<I> & uf, I a, const TypedBitSet<I> * region = nullptr ) |
| 32 | { |
| 33 | MR_TIMER; |
| 34 | TypedBitSet<I> res( uf.size() ); |
| 35 | a = uf.find( a ); |
| 36 | BitSetParallelForAllRanged( res, [&]( I i, const auto & range ) |
| 37 | { |
| 38 | if ( region && !region->test( i ) ) |
| 39 | return; |
| 40 | if ( a == uf.findUpdateRange( i, range.beg, range.end ) ) |
| 41 | res.set( i ); |
| 42 | } ); |
| 43 | return res; |
| 44 | } |
| 45 | |
| 46 | /// returns true if there is no set in UnionFind that contains both an element from the given region and another element not from the region; |
| 47 | /// in other words, UnionFind contains a subdivision of both region and not-region on subsets |
no test coverage detected