One problem I have faced a couple of times in the past is this: we’re given a list of objects, and a list of identifications of two objects. How many groups of objects are there after we perform the identifications? In mathematical parlance we’re given a set, a relation, and we’re asked to find the equivalence classes under the equivalence relation generated by the given relation.