Union-find data structure created locally and passed to subroutines.