class_docstr: The topology of a forest, using a split-based graph-structure representation.
  
  Parameters
  ----------
  n_labels : int
      Number of labels, the set of labels is then :math:`\{0,\dots,n-1\}`.
  partition : tuple
      A tuple of tuples that is a partition of the set :math:`\{0,\dots,n-1\}`,
      representing the label sets of each connected component of the forest topology.
  split_sets : tuple
      A tuple of tuples containing splits, where each set of splits contains only
      splits of the respective label set in the partition, so their order
      is related. The splits are the edges of the connected components of the forest,
      respectively, and thus the union of all sets of splits yields all edges of the
      forest topology.
  
  Attributes
  ----------
  where : dict
      Give the index of a split in the flattened list of all splits.
  sep : list of int
      An increasing list of numbers between 0 and m, where m is the total number
      of splits in ``self.split_sets``, starting with 0, where each number
      indicates that a new connected component starts at that index.
      Useful for example for unraveling the tuple of all splits into
      ``self.split_sets``.
  paths : list of dict
      A list of dictionaries, each dictionary is for the respective connected
      component of the forest, and the items of each dictionary are for each pair
      of labels u, v, u < v in the respective component, a list of the splits on the
      unique path between the labels u and v.
  support : list of array-like
      For each split, give an :math:`n\times n` dimensional matrix, where the
      uv-th entry is ``True`` if the split separates the labels u and v, else
      ``False``.
class_docstr_tok: ["The","topology","of","a","forest",",","using","a","split-based","graph-structure","representation",".","Parameters","--","--","--","--","--","n_labels",":","int","Number","of","labels",",","the","set","of","labels","is","then",":","math",":","`","\\","{","0",",","\\dots",",","n-1\\","}","`",".","partition",":","tuple","A","tuple","of","tuples","that","is","a","partition","of","the","set",":","math",":","`","\\","{","0",",","\\dots",",","n-1\\","}","`",",","representing","the","label","sets","of","each","connected","component","of","the","forest","topology",".","split_sets",":","tuple","A","tuple","of","tuples","containing","splits",",","where","each","set","of","splits","contains","only","splits","of","the","respective","label","set","in","the","partition",",","so","their","order","is","related",".","The","splits","are","the","edges","of","the","connected","components","of","the","forest",",","respectively",",","and","thus","the","union","of","all","sets","of","splits","yields","all","edges","of","the","forest","topology",".","Attributes","--","--","--","--","--","where",":","dict","Give","the","index","of","a","split","in","the","flattened","list","of","all","splits",".","sep",":","list","of","int","An","increasing","list","of","numbers","between","0","and","m",",","where","m","is","the","total","number","of","splits","in","``","self.split_sets","``",",","starting","with","0",",","where","each","number","indicates","that","a","new","connected","component","starts","at","that","index",".","Useful","for","example","for","unraveling","the","tuple","of","all","splits","into","``","self.split_sets","``",".","paths",":","list","of","dict","A","list","of","dictionaries",",","each","dictionary","is","for","the","respective","connected","component","of","the","forest",",","and","the","items","of","each","dictionary","are","for","each","pair","of","labels","u",",","v",",","u","<","v","in","the","respective","component",",","a","list","of","the","splits","on","the","unique","path","between","the","labels","u","and","v.","support",":","list","of","array-like","For","each","split",",","give","an",":","math",":","`","n\\times","n","`","dimensional","matrix",",","where","the","uv-th","entry","is","``","True","``","if","the","split","separates","the","labels","u","and","v",",","else","``","False","``","."]
docstr: Check if ``self`` is less than or equal to ``other``.
  
  This partial ordering is the one defined in [1] and to show if self <= other is
  True, three things must be satisfied.
  (i)     ``self.partition`` must be a refinement of ``other.partition`` in the
          sense of partitions.
  (ii)    The splits of each component in ``self`` must be contained in the
          set of splits of ``other`` restricted to the component of ``self``.
  (iii)   Whenever two components of ``self`` are contained in a component of
          ``other``, there needs to exist a split in ``other`` separating those
          two components.
  If one of those three conditions are not fulfilled, this method returns False.
  
  Parameters
  ----------
  other : Topology
      The structure to which self is compared to.
  
  Returns
  -------
  is_less_than_or_equal : bool
      Return ``True`` if (i), (ii) and (iii) are satisfied, else ``False``.
code: def __le__(self, other):
      """Check if ``self`` is less than or equal to ``other``.
  
      This partial ordering is the one defined in [1] and to show if self <= other is
      True, three things must be satisfied.
      (i)     ``self.partition`` must be a refinement of ``other.partition`` in the
              sense of partitions.
      (ii)    The splits of each component in ``self`` must be contained in the
              set of splits of ``other`` restricted to the component of ``self``.
      (iii)   Whenever two components of ``self`` are contained in a component of
              ``other``, there needs to exist a split in ``other`` separating those
              two components.
      If one of those three conditions are not fulfilled, this method returns False.
  
      Parameters
      ----------
      other : Topology
          The structure to which self is compared to.
  
      Returns
      -------
      is_less_than_or_equal : bool
          Return ``True`` if (i), (ii) and (iii) are satisfied, else ``False``.
      """
  
      class NotPartialOrder(Exception):
          """Raise an exception when less equal is not true."""
  
      x_parts = [set(x) for x in self.partition]
      y_parts = [set(y) for y in other.partition]
      # (i)
      try:
          cover = {
              i: [j for j, y in enumerate(y_parts) if x.issubset(y)][0]
              for i, x in enumerate(x_parts)
          }
      except IndexError:
          return False
      # (ii)
      try:
          for (i, j), x in zip(cover.items(), x_parts):
              y_splits_restricted = {
                  split_y.restrict_to(subset=x)
                  for split_y in other.split_sets[j]
              }
              if not set(self.split_sets[i]).issubset(
                  y_splits_restricted
              ):
                  raise NotPartialOrder()
      except NotPartialOrder:
          return False
      # (iii)
      try:
          for j in range(len(y_parts)):
              xs_in_y = [
                  x for i, x in enumerate(x_parts) if cover[i] == j
              ]
              for x1, x2 in itertools.combinations(xs_in_y, r=2):
                  sep_sp = [
                      sp
                      for sp in other.split_sets[j]
                      if sp.separates(x1, x2)
                  ]
                  if not sep_sp:
                      raise NotPartialOrder()
      except NotPartialOrder:
          return False
      return True
  
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 7 for calling the Topology obj's underlying member method code with example usage: obj.__le__(other) and returns: True, False, False, False