code: def estimate_band_connection(prev_eigvecs, eigvecs, prev_band_order):
      
      metric = np.abs(np.dot(prev_eigvecs.conjugate().T, eigvecs))
      connection_order = []
      for overlaps in metric:
          maxval = 0
          for i in reversed(range(len(metric))):
              val = overlaps[i]
              if i in connection_order:
                  continue
              if val > maxval:
                  maxval = val
                  maxindex = i
          connection_order.append(maxindex)
  
      band_order = [connection_order[x] for x in prev_band_order]
  
      return band_order
docs: A function to order the phonon eigenvectors taken from phonopy