Creates new instance with n
initial singular subsets.
initial capacity, ID range [0..n)
Returns canonical ID (tree root) for given id
. Unless id
already is unified with some other ID, this will always return id
itself (since each node is initially its own root).
node ID
Returns a Map
of all subsets (connected components) with their canonical tree root IDs as keys and arrays of node IDs as values.
Returns true, if the given two nodes belong to the same tree / subset.
node ID
node ID
Connects combines the trees of the given two node IDs and returns the new resulting canonical tree root ID.
node ID
node ID
Generated using TypeDoc
Typed array based Disjoint Set implementation with quick union and path compression, after Sedgewick & Wayne.