Data.Union
Description
Immutable disjoint set forests.
data Union a Source #
An immutable disjoint set forest.
newtype Node Source #
A node in a disjoint set forest.
Constructors
Fields
Defined in Data.Union.Type
Methods
(==) :: Node -> Node -> Bool #
(/=) :: Node -> Node -> Bool #
compare :: Node -> Node -> Ordering #
(<) :: Node -> Node -> Bool #
(<=) :: Node -> Node -> Bool #
(>) :: Node -> Node -> Bool #
(>=) :: Node -> Node -> Bool #
max :: Node -> Node -> Node #
min :: Node -> Node -> Node #
range :: (Node, Node) -> [Node] #
index :: (Node, Node) -> Node -> Int #
unsafeIndex :: (Node, Node) -> Node -> Int #
inRange :: (Node, Node) -> Node -> Bool #
rangeSize :: (Node, Node) -> Int #
unsafeRangeSize :: (Node, Node) -> Int #
size :: Union l -> Int Source #
Get the number of nodes in the forest.
lookup :: Union l -> Node -> (Node, l) Source #
Look up the representative of a node, and its label.
lookupFlattened :: Union a -> Node -> (Node, a) Source #
Version of lookup that assumes the forest to be flattened. (cf. flatten.)
lookup
flatten
Do not use otherwise: It will give wrong results!