def k_ring_distances(origin, k)
      max_out_size = max_kring_size(k)
      out = H3Indexes.of_size(max_out_size)
      distances = FFI::MemoryPointer.new(:int, max_out_size)
      Bindings::Private.k_ring_distances(origin, k, out, distances)

      hexagons = out.read
      distances = distances.read_array_of_int(max_out_size)

      Hash[
        distances.zip(hexagons).group_by(&:first).map { |d, hs| [d, hs.map(&:last)] }
      ]
    end
def k_ring_distances(origin, k)
      max_out_size = max_kring_size(k)
      out = H3Indexes.of_size(max_out_size)
      distances = FFI::MemoryPointer.new(:int, max_out_size)
      Bindings::Private.k_ring_distances(origin, k, out, distances)

      hexagons = out.read
      distances = distances.read_array_of_int(max_out_size)

      Hash[
        distances.zip(hexagons).group_by(&:first).map { |d, hs| [d, hs.map(&:last)] }
      ]
    end
Derives the k-ring for the given origin at k distance, sub-grouped by distance.

 @param [Integer] origin Origin H3 index.
 @param [Integer] k K distance.

 @example Derive k-ring at distance 2
   H3.k_ring_distances(617700169983721471, 2)
   {
     0 => [617700169983721471],
     1 = >[
       617700170047946751, 617700169984245759, 617700169982672895,
       617700169983983615, 617700170044276735, 617700170044014591
     ],
     2 => [
       617700170048995327, 617700170047684607, 617700170048471039,
       617700169988177919, 617700169983197183, 617700169983459327,
       617700169982935039, 617700175096053759, 617700175097102335,
       617700170043752447, 617700170043490303, 617700170045063167
     ]
   }

 @return [Hash] Hash of k-ring distances grouped by distance.