class_docstr: !
  @brief Class represents agglomerative algorithm for cluster analysis.
  @details Agglomerative algorithm considers each data point (object) as a separate cluster at the beginning and
            step by step finds the best pair of clusters for merge until required amount of clusters is obtained.
  
  Example of agglomerative algorithm where centroid link is used:
  @code
      from pyclustering.cluster.agglomerative import agglomerative, type_link
      from pyclustering.cluster import cluster_visualizer
      from pyclustering.samples.definitions import FCPS_SAMPLES
      from pyclustering.utils import read_sample
  
      # Sample for cluster analysis (represented by list)
      sample = read_sample(FCPS_SAMPLES.SAMPLE_TARGET)
  
      # Create object that uses python code only
      agglomerative_instance = agglomerative(sample, 6, type_link.SINGLE_LINK, ccore=True)
  
      # Cluster analysis
      agglomerative_instance.process()
  
      # Obtain results of clustering
      clusters = agglomerative_instance.get_clusters()
  
      # Visualize clustering results
      visualizer = cluster_visualizer()
      visualizer.append_clusters(clusters, sample)
      visualizer.show()
  @endcode
  
  There is example of clustering 'LSUN' sample:
  @code
      from pyclustering.cluster.agglomerative import agglomerative, type_link
      from pyclustering.cluster import cluster_visualizer
      from pyclustering.samples.definitions import FCPS_SAMPLES
      from pyclustering.utils import read_sample
  
      # sample Lsun for cluster analysis
      lsun_sample = read_sample(FCPS_SAMPLES.SAMPLE_LSUN)
  
      # create instance of the algorithm that will use ccore library (the last argument)
      agglomerative_instance = agglomerative(lsun_sample, 3, type_link.SINGLE_LINK, True)
  
      # start processing
      agglomerative_instance.process()
  
      # get result and visualize it
      lsun_clusters = agglomerative_instance.get_clusters()
      visualizer = cluster_visualizer()
      visualizer.append_clusters(lsun_clusters, lsun_sample)
      visualizer.show()
  @endcode
  
  Example of agglomerative clustering using different links:
  @image html agglomerative_lsun_clustering_single_link.png
class_docstr_tok: ["!","@","brief","Class","represents","agglomerative","algorithm","for","cluster","analysis",".","@","details","Agglomerative","algorithm","considers","each","data","point","(","object",")","as","a","separate","cluster","at","the","beginning","and","step","by","step","finds","the","best","pair","of","clusters","for","merge","until","required","amount","of","clusters","is","obtained",".","Example","of","agglomerative","algorithm","where","centroid","link","is","used",":","@","code","from","pyclustering.cluster.agglomerative","import","agglomerative",",","type_link","from","pyclustering.cluster","import","cluster_visualizer","from","pyclustering.samples.definitions","import","FCPS_SAMPLES","from","pyclustering.utils","import","read_sample","#","Sample","for","cluster","analysis","(","represented","by","list",")","sample","=","read_sample","(","FCPS_SAMPLES.SAMPLE_TARGET",")","#","Create","object","that","uses","python","code","only","agglomerative_instance","=","agglomerative","(","sample",",","6",",","type_link.SINGLE_LINK",",","ccore=True",")","#","Cluster","analysis","agglomerative_instance.process","(",")","#","Obtain","results","of","clustering","clusters","=","agglomerative_instance.get_clusters","(",")","#","Visualize","clustering","results","visualizer","=","cluster_visualizer","(",")","visualizer.append_clusters","(","clusters",",","sample",")","visualizer.show","(",")","@","endcode","There","is","example","of","clustering","'LSUN","'","sample",":","@","code","from","pyclustering.cluster.agglomerative","import","agglomerative",",","type_link","from","pyclustering.cluster","import","cluster_visualizer","from","pyclustering.samples.definitions","import","FCPS_SAMPLES","from","pyclustering.utils","import","read_sample","#","sample","Lsun","for","cluster","analysis","lsun_sample","=","read_sample","(","FCPS_SAMPLES.SAMPLE_LSUN",")","#","create","instance","of","the","algorithm","that","will","use","ccore","library","(","the","last","argument",")","agglomerative_instance","=","agglomerative","(","lsun_sample",",","3",",","type_link.SINGLE_LINK",",","True",")","#","start","processing","agglomerative_instance.process","(",")","#","get","result","and","visualize","it","lsun_clusters","=","agglomerative_instance.get_clusters","(",")","visualizer","=","cluster_visualizer","(",")","visualizer.append_clusters","(","lsun_clusters",",","lsun_sample",")","visualizer.show","(",")","@","endcode","Example","of","agglomerative","clustering","using","different","links",":","@","image","html","agglomerative_lsun_clustering_single_link.png"]
docstr: !
  @brief Finds two nearest objects in two specified clusters and returns distance between them.
  
  @param[in] (uint) Index of the first cluster.
  @param[in] (uint) Index of the second cluster.
  
  @return The nearest euclidean distance between two clusters.
docstr_tok: ["!","@","brief","Finds","two","nearest","objects","in","two","specified","clusters","and","returns","distance","between","them",".","@","param","[","in","]","(","uint",")","Index","of","the","first","cluster",".","@","param","[","in","]","(","uint",")","Index","of","the","second","cluster",".","@","return","The","nearest","euclidean","distance","between","two","clusters","."]
code: def __calculate_nearest_distance(
      self, index_cluster1, index_cluster2
  ):
      """!
      @brief Finds two nearest objects in two specified clusters and returns distance between them.
  
      @param[in] (uint) Index of the first cluster.
      @param[in] (uint) Index of the second cluster.
  
      @return The nearest euclidean distance between two clusters.
  
      """
      candidate_minimum_distance = float("Inf")
  
      for index_object1 in self.__clusters[index_cluster1]:
          for index_object2 in self.__clusters[index_cluster2]:
              distance = euclidean_distance_square(
                  self.__pointer_data[index_object1],
                  self.__pointer_data[index_object2],
              )
              if distance < candidate_minimum_distance:
                  candidate_minimum_distance = distance
  
      return candidate_minimum_distance
  
imports: from enum import IntEnum
  from pyclustering.cluster.encoder import type_encoding
  from pyclustering.utils import euclidean_distance_square
  from pyclustering.core.wrapper import ccore_library
  import pyclustering.core.agglomerative_wrapper
label_desc: Use image node_id 11 for calling the agglomerative obj's underlying member method code with example usage: obj.__calculate_nearest_distance(index_cluster1, index_cluster2) and returns: candidate_minimum_distance