template<typename IM>
class lemon::UnionFindEnum< IM >
The class implements a Union-Find data structure which is able to enumerate the components and the items in a component. If you don't need this feature then perhaps it's better to use the UnionFind class which is more efficient.
The union operation uses rank heuristic, while the find operation uses path compression.
- Precondition
- You need to add all the elements by the insert() method.
|
| int | insert (const Item &item) |
| | Inserts the given element into a new component.
|
| |
| void | insert (const Item &item, int cls) |
| | Inserts the given element into the component of the others.
|
| |
| void | clear () |
| | Clears the union-find data structure.
|
| |
| int | find (const Item &item) const |
| | Finds the component of the given element.
|
| |
| int | join (const Item &a, const Item &b) |
| | Joining the component of element a and element b.
|
| |
| int | size (int cls) const |
| | Returns the size of the class.
|
| |
| void | split (int cls) |
| | Splits up the component.
|
| |
| void | erase (const Item &item) |
| | Removes the given element from the structure.
|
| |
| Item | item (int cls) const |
| | Gives back a representant item of the component.
|
| |
| void | eraseClass (int cls) |
| | Removes the component of the given element from the structure.
|
| |