| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.DisjointSet.Int
Description
This module contains non-monadic functions for querying disjoint int sets. See Data.DisjointSet.Int.Monadic for information about how to create and modify disjoint int sets.
There are two other disjoint int set packages on hackage, namely:
- "disjoint-set"
- "disjoint-sets-st"
The first is a pure disjoint int set implementation, so as it doesn't do in place array updates in ST it will presumably be somewhat slower, with the data structure used likely taking more space and having log(n) access speed.
This package does not include a pure implementation, you're better off using "disjoint-set" for that.
"disjoint-sets-st" does offer an implementation in IO, however, it's missing two features:
1) The ability to "freeze" a disjoint set, and then query it in a pure way. 2) Maintaining a circular linked list of each set so one can quickly discover all the elements of one set without quering through the entire structure.
This package implements both of the above features.
- find :: DisjointIntSet -> Int -> Int
- count :: DisjointIntSet -> Int -> Int
- findAndCount :: DisjointIntSet -> Int -> (Int, Int)
- numSets :: DisjointIntSet -> Int
- size :: DisjointIntSet -> Int
- nextInSet :: DisjointIntSet -> Int -> Int
- setToList :: DisjointIntSet -> Int -> [Int]
Documentation
findAndCount :: DisjointIntSet -> Int -> (Int, Int) Source #
numSets :: DisjointIntSet -> Int Source #
How many distinct sets.
size :: DisjointIntSet -> Int Source #
How many elements in this disjoint set.