class_docstr: A class for wälder, that are phylogenetic forests, elements of the Wald Space.
  
  Parameters
  ----------
  topology : Topology
      The structure of the forest.
  weights : array-like
      The edge weights, array of floats between 0 and 1, with m entries, where m is
      the total number of splits/edges in the structure ``top``.
class_docstr_tok: ["A","class","for","w\u00e4lder",",","that","are","phylogenetic","forests",",","elements","of","the","Wald","Space",".","Parameters","--","--","--","--","--","topology",":","Topology","The","structure","of","the","forest",".","weights",":","array-like","The","edge","weights",",","array","of","floats","between","0","and","1",",","with","m","entries",",","where","m","is","the","total","number","of","splits\/edges","in","the","structure","``","top","``","."]
docstr: Generate random maximal set of compatible splits of set ``labels``.
  
  This method works inductively on the number of elements in labels.
  Start with a split of two randomly chosen labels. Then, successively choose
  a label from the labels and add this as a leaf with a split to the existing
  tree by attaching it to a random split, thereby dividing this split into two
  splits and one has to update all the other splits accordingly.
  
  Parameters
  ----------
  labels : list[int]
      A list of integers, the set of labels that we generate splits for.
  
  Returns
  -------
  splits : list[Split]
      A list of splits of the set of labels, maximal number of splits.
code: def _generate_splits(labels):
      """Generate random maximal set of compatible splits of set ``labels``.
  
      This method works inductively on the number of elements in labels.
      Start with a split of two randomly chosen labels. Then, successively choose
      a label from the labels and add this as a leaf with a split to the existing
      tree by attaching it to a random split, thereby dividing this split into two
      splits and one has to update all the other splits accordingly.
  
      Parameters
      ----------
      labels : list[int]
          A list of integers, the set of labels that we generate splits for.
  
      Returns
      -------
      splits : list[Split]
          A list of splits of the set of labels, maximal number of splits.
      """
      if len(labels) <= 1:
          return []
      unused_labels = labels.copy()
      random_index = int(gs.random.randint(0, len(unused_labels), (1,)))
      u = unused_labels.pop(random_index)
      random_index = int(gs.random.randint(0, len(unused_labels), (1,)))
      v = unused_labels.pop(random_index)
      used_labels = [u, v]
      splits = [Split(part1={u}, part2={v})]
      while unused_labels:
          random_index = int(
              gs.random.randint(0, len(unused_labels), (1,))
          )
          u = unused_labels.pop(random_index)
          updated_splits = [Split(part1={u}, part2=used_labels)]
          random_index = int(gs.random.randint(0, len(splits), (1,)))
          divided_split = splits.pop(random_index)
          updated_splits.append(
              Split(
                  part1=divided_split.part1 | {u},
                  part2=divided_split.part2,
              )
          )
          updated_splits.append(
              Split(
                  part1=divided_split.part1,
                  part2=divided_split.part2 | {u},
              )
          )
          for split in splits:
              updated_splits.append(
                  Split(
                      part1=split.get_part_away_from(divided_split),
                      part2=split.get_part_towards(divided_split) | {u},
                  )
              )
          used_labels.append(u)
          splits = updated_splits
      return splits
  
imports: import functools
  import itertools
  import geomstats.backend
  import geomstats.geometry.spd_matrices
  from geomstats.geometry.stratified.point_set import Point, PointSet, _vectorize_point
label_desc: Use image node_id 11 for calling the Wald obj's underlying member method code with example usage: obj._generate_splits(labels) and returns: splits, list