code: def epsilon_net_indices(
      X: npt.NDArray[np.float32], dim: Optional[int] = None
  ) -> np.ndarray:
      """
      Outputs an order of the items in the provided array such that the items are
      spaced well. This means that after choosing a seed item, the next item is
      chosen to be the farthest from the seed item. The third item is then chosen
      to maximize the distance to the existing points and so on.
  
      This algorithm is taken from "Nearest-Neighbor Searching and Metric Space Dimensions"
      (Clarkson, 2005, p.17).
  
      Args:
          X: Array of shape [N, D] (N: number of items, D: dimensionality) with the items to
              sparsify.
          dim: The index of the dimension which to use to choose the seed item. If `None`, an item is
              chosen at random, otherwise the item with the lowest value in the specified dimension
              is used.
  
      Returns:
          An array of shape [N] providing the item indices that define a sparsified order of the
              items.
      """
      indices = set(range(X.shape[0]))
  
      # Choose the seed item according to dim
      if dim is None:
          seed = np.random.choice(X.shape[0])
      else:
          seed = np.argmin(X, axis=0)[dim]
  
      # Initialize the order
      order = [seed]
      indices.remove(seed)
  
      # Iterate until all models have been chosen
      while indices:
          # Get the distance to all items that have already been chosen
          ordered_indices = list(indices)
          diff = (
              X[ordered_indices][:, None, :].repeat(len(order), axis=1)
              - X[order]
          )
          min_distances = np.linalg.norm(diff, axis=-1).min(-1)
  
          # Then, choose the one with the maximum distance to all points
          choice = ordered_indices[min_distances.argmax()]
          order.append(choice)
          indices.remove(choice)
  
      return np.array(order)
  
imports: from typing import List, Optional, Union
  import numpy
  import numpy.typing
  import scipy.stats
label_desc: Use image node_id 2 for calling a global function with example usage: epsilon_net_indices(X, dim) and returns: np