#include <UnionFind.h>
|
| UnionFind (size_t n) |
|
bool | same (size_t i, size_t j) |
|
bool | different (size_t i, size_t j) |
|
size_t | find (size_t i) |
|
void | join (size_t i, size_t j) |
|
size_t | getNumClusters () const |
|
template<typename T > |
void | sortByCluster (T begin, T end) |
|
Clusters | getClusters () |
|
Clusters | getClusters (std::vector< size_t > elems) |
|
UnionFind provides an implementation of a disjoint set data structure that is useful in clustering. Elements to be clustered are referred to according to a numeric index.
◆ UnionFind()
geos::operation::cluster::UnionFind::UnionFind |
( |
size_t |
n | ) |
|
|
inlineexplicit |
Create a UnionFind object
- Parameters
-
n | the number of elements to be clustered (fixed size) |
◆ find()
size_t geos::operation::cluster::UnionFind::find |
( |
size_t |
i | ) |
|
|
inline |
Return the ID of the cluster associated with an item
- Parameters
-
i | index of the item to lookup |
- Returns
- a numeric cluster ID
◆ getClusters() [1/2]
Clusters geos::operation::cluster::UnionFind::getClusters |
( |
| ) |
|
Return the clusters associated with all elements
- Returns
- an object that allows iteration over the elements of each cluster
◆ getClusters() [2/2]
Clusters geos::operation::cluster::UnionFind::getClusters |
( |
std::vector< size_t > |
elems | ) |
|
Return the clusters associated with the given elements
- Parameters
-
elems | a vector of element ids |
- Returns
- an object that allows iteration over the elements of each cluster
◆ join()
void geos::operation::cluster::UnionFind::join |
( |
size_t |
i, |
|
|
size_t |
j |
|
) |
| |
|
inline |
Merge the clusters associated with two items
- Parameters
-
i | ID of an item associated with the first cluster |
j | ID of an item associated with the second cluster |
The documentation for this class was generated from the following file: