union-find-array-0.1.0.1: union find data structure

Safe HaskellNone

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

fromNode :: Int
 

Instances

size :: Union l -> IntSource

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!