Simple union-find structure
authorTeemu Murtola <teemu.murtola@gmail.com>
Sat, 19 Aug 2017 18:59:05 +0000 (21:59 +0300)
committerMark Abraham <mark.j.abraham@gmail.com>
Mon, 21 Aug 2017 15:45:58 +0000 (17:45 +0200)
commit947fe55223fb401f31e869ccdbf9c6743e4f286b
tree690a1302972ea07115de5342a3c9167480b23131
parentd249ed754fb0a89a6290f34b019961ffd14c5a7b
Simple union-find structure

Implement a simple data structure that, given a list of items
(represented by integer indices), keeps track of a partitioning of these
items into disjoint sets.  Operations to merge two such sets (given two
member items) and to query the "index" of a set are amortized constant
time.  This is a well-known "Union-Find" data structure.

Change-Id: I0bd907755d709776eac416332a4a1bcd139f135f
src/gromacs/trajectoryanalysis/modules/unionfind.h [new file with mode: 0644]
src/gromacs/trajectoryanalysis/tests/CMakeLists.txt
src/gromacs/trajectoryanalysis/tests/unionfind.cpp [new file with mode: 0644]