Minimum spanning tree
Kruskal's algorithm: take the lightest edge left, and keep it only if its ends are in different sets. Union Find answers that question in almost constant time.
edgesQueue gives the lightest edge first. In the forest an arrow goes from each node to its parent; rank counts the nodes in each root's tree.