Union-Find

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

Canonical Use

The canonical use of a union-find data structure is to maintain a partition of a set of objects. Examples:

  • Maintaining the connected components that represent partial spanning trees in Kruskal's algorithm.

Supported Operations

FIND(X)

Given an object from the universe of objects maintained by the union-find, return the name of the group (partition) this object belongs.

UNION(Ci,Cj)

The union operation takes the name of two groups and fuses the groups together: the objects in group Ci and the objects in group Cj coalesced and become members of a sole group.

Simple Implementation

Union by Rank

Path Compression