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 a random partition of :math:`\{0,\dots,n-1\}`.
  
  This algorithm works as follows: Start with a single set containing zero,
  then successively add the labels from 1 to n-1 to the partition in the
  following manner: for each label u, with probability `probability`, add the
  label u to a random existing set of the partition, else add a new singleton
  set {u} to the partition (i.e. with probability 1 - `probability`).
  
  Parameters
  ----------
  p_new : float
      A float between 0 and 1, the probability that no new component is added,
      and 1 - probability that a new component is added.
  
  Returns
  -------
  partition : list[list[int]]
      A partition of the set :math:`\{0,\dots,n-1\}` into non-empty sets.
code: def _generate_partition(n_labels, p_new):
      r"""Generate a random partition of :math:`\{0,\dots,n-1\}`.
  
      This algorithm works as follows: Start with a single set containing zero,
      then successively add the labels from 1 to n-1 to the partition in the
      following manner: for each label u, with probability `probability`, add the
      label u to a random existing set of the partition, else add a new singleton
      set {u} to the partition (i.e. with probability 1 - `probability`).
  
      Parameters
      ----------
      p_new : float
          A float between 0 and 1, the probability that no new component is added,
          and 1 - probability that a new component is added.
  
      Returns
      -------
      partition : list[list[int]]
          A partition of the set :math:`\{0,\dots,n-1\}` into non-empty sets.
      """
      _partition = [[0]]
      for u in range(1, n_labels):
          if gs.random.rand(1) < p_new:
              index = int(gs.random.randint(0, len(_partition), (1,)))
              _partition[index].append(u)
          else:
              _partition.append([u])
      return _partition
  
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 10 for calling the Wald obj's underlying member method code with example usage: obj._generate_partition(n_labels, p_new) and returns: _partition