class_docstr: Union-find data structure.
  
  Each unionFind instance X maintains a family of disjoint sets of
  hashable objects, supporting the following two methods:
  
  - X[item] returns a name for the set containing the given item.
    Each set is named by an arbitrarily-chosen one of its members; as
    long as the set remains unchanged it will keep the same name. If
    the item is not yet part of a set in X, a new singleton set is
    created for it.
  
  - X.union(item1, item2, ...) merges the sets containing each item
    into a single larger set.  If any item is not yet part of a set
    in X, it is added to X as one of the members of the merged set.
  
    Union-find data structure. Based on Josiah Carlson's code,
    https://code.activestate.com/recipes/215912/
    with significant additional changes by D. Eppstein.
    http://www.ics.uci.edu/~eppstein/PADS/UnionFind.py
docstr: Iterates over the sets stored in this structure.
  
  For example::
  
      >>> partition = UnionFind("xyz")
      >>> sorted(map(sorted, partition.to_sets()))
      [['x'], ['y'], ['z']]
      >>> partition.union("x", "y")
      >>> sorted(map(sorted, partition.to_sets()))
      [['x', 'y'], ['z']]
docstr_tok: ["Iterates","over","the","sets","stored","in","this","structure",".","For","example",":",":",">",">",">","partition","=","UnionFind","(","``","xyz","''",")",">",">",">","sorted","(","map","(","sorted",",","partition.to_sets","(",")",")",")","[","[","'","x","'","]",",","[","'","y","'","]",",","[","'","z","'","]","]",">",">",">","partition.union","(","``","x","''",",","``","y","''",")",">",">",">","sorted","(","map","(","sorted",",","partition.to_sets","(",")",")",")","[","[","'","x","'",",","'","y","'","]",",","[","'","z","'","]","]"]
code: def to_sets(self):
      """Iterates over the sets stored in this structure.
  
      For example::
  
          >>> partition = UnionFind("xyz")
          >>> sorted(map(sorted, partition.to_sets()))
          [['x'], ['y'], ['z']]
          >>> partition.union("x", "y")
          >>> sorted(map(sorted, partition.to_sets()))
          [['x', 'y'], ['z']]
  
      """
      # Ensure fully pruned paths
      for x in self.parents:
          _ = self[x]  # Evaluated for side-effect only
  
      yield from groups(self.parents).values()
  
imports: from networkx.utils import groups
label_desc: Use image node_id 4 for calling the UnionFind obj's underlying member method code with example usage: obj.to_sets() without return types