Gromacs
2018.8
|
#include <gromacs/trajectoryanalysis/modules/unionfind.h>
Union-find data structure for keeping track of disjoint sets.
Union-find keeps track of a number of items, represented here by continuous integer indices starting at zero, and supports the following operations:
Note that in order to achieve the amortized behavior, querying the structure modifies the internal state, but does not alter the externally visible behavior.
Public Member Functions | |
void | init (int count) |
Initializes count items, putting each in its own set. | |
void | merge (int item1, int item2) |
Merges sets that contain two given items. More... | |
int | representativeItem (int item) |
Returns a representative item from the set containing item . | |
std::vector< int > | allSizes () |
Returns the sizes of all sets (in arbitrary order). | |
|
inline |
Merges sets that contain two given items.
If the items are already in the same set, nothing happens.