Union-Find

Introduction

datastructures defines the interface for mutable data structures representing partitions of [1..n], commonly known as union-find data structures. Key operations are which fuses two parts of a partition and which returns a canonical representative of the part containing a given point.

API

true or false Category of datastructures representing partitions. Equality is identity and family is ignored. Family containing all partition data structures Returns the trivial partition of the set [1..n]. Returns the union find structure of partition. a positive integer Returns a canonical representative of the part of the partition that k is contained in. Fuses the parts of the partition unionfind containing k1 and k2. an iterator Returns an iterator that runs through canonical representatives of parts of the partition unionfind. a positive integer Returns the number of parts of the partition unionfind. a positive integer Returns the size of the underlying set of the partition unionfind. a list of lists Returns the partition unionfind as a list of lists.