toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.UnionFind.Sparse

Description

Sparse Union-Find implementation

Typical problems

Synopsis

Documentation

type SparseUnionFind = IntMap Int #

@gotoki_no_joe. Vertex -> -size | root (negative if it's root)

memberSUF :: Int -> SparseUnionFind -> Bool #

\(O(\log N)\)

fromListSUF :: [(Int, Int)] -> SparseUnionFind #

\(O(E)\) From edges

fromVecSUF :: Vector (Int, Int) -> SparseUnionFind #

\(O(E)\) From edges

rootSUF :: HasCallStack => Int -> SparseUnionFind -> (Int, Int) #

\(O(\min(N, W))\) Returns (root, size)

sameSUF :: HasCallStack => Int -> Int -> SparseUnionFind -> Bool #

\(O(\min(N, W))\)

unifySUF :: HasCallStack => Int -> Int -> SparseUnionFind -> SparseUnionFind #

\(O(\min(N, W))\)