lib/individual.rb
# Reduce partial map for PMX by extracting first key and last value.
# Given hash is reduced recursively.
# {1=>2, 2=>3, 3=>4}
# -> {1=>3, 3=>4}
# -> {1=>4}

Reduce partial map for PMX by extracting first key and last value.
Given hash is reduced recursively.
Reduce partial map for PMX by extracting first key and last value . Given hash is reduced recursively .
def reduce_partial_map(h, k, v)
    if h[v] == nil  
      return h
    end
    h[k] = h[v]  
    h.delete v   
    reduce_partial_map(h, k, v)
  end
def reduce_partial_map ( h , k , v ) if h [ v ] == nil return h end h [ k ] = h [ v ] h . delete v reduce_partial_map ( h , k , v ) end
Reduce partial map for PMX by extracting first key and last value.
Reduce partial map for PMX by extracting first key and last value .
# last value
 # remove intermediate key by replacing it value
 # replace value
 # remove key
 # call it recursively with reduced hash

h
<not_specific>
k
<not_specific>
v
<not_specific>