union-find-array-0.1.0.4: union find data structure
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Union

Description

Immutable disjoint set forests.

Synopsis

Documentation

data Union a Source #

An immutable disjoint set forest.

newtype Node Source #

A node in a disjoint set forest.

Constructors

Node 

Fields

Instances

Instances details
Ix Node Source # 
Instance details

Defined in Data.Union.Type

Methods

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 #

Eq Node Source # 
Instance details

Defined in Data.Union.Type

Methods

(==) :: Node -> Node -> Bool #

(/=) :: Node -> Node -> Bool #

Ord Node Source # 
Instance details

Defined in Data.Union.Type

Methods

compare :: Node -> Node -> Ordering #

(<) :: Node -> Node -> Bool #

(<=) :: Node -> Node -> Bool #

(>) :: Node -> Node -> Bool #

(>=) :: Node -> Node -> Bool #

max :: Node -> Node -> Node #

min :: Node -> Node -> Node #

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.)

Do not use otherwise: It will give wrong results!