Disjoint Set

class DisjointSet

Public Functions

inline DisjointSet(const int nodeCount)
inline int find(const int node) const

The root of the tree containing the node.

inline int size() const

Total number of nodes.

inline int size(const int node)

Size of the subtree containing a node.

inline void merge(int node1, int node2)

Merge two components.