parameters: (simmatrixarray)
return_statement: return mappings[:min(simmatrixarray.shape)]
docstring: return a mapping of the atoms in the similarity matix using the heuristic algorithm described in the paper
docstring_summary: return a mapping of the atoms in the similarity matix using the heuristic algorithm described in the paper
docstring_tokens: return a mapping of the atoms in the similarity matix using the heuristic algorithm described in the paper
function: def getmappings(simmatrixarray):
    '''return a mapping of the atoms in the similarity matix using the heuristic algorithm described in the paper'''
  
    costarray = numpy.ones(simmatrixarray.shape) - simmatrixarray
  
    it = numpy.nditer(costarray, flags=['multi_index'], op_flags=['writeonly'])
    dsu = []
    for a in it:
      dsu.append((a, it.multi_index[0], it.multi_index[1]))
    dsu.sort()
  
    seena = set()
    seenb = set()
    mappings = []
    for sim, a, b in dsu:
      if a not in seena and b not in seenb:
        seena.add(a)
        seenb.add(b)
        mappings.append((a, b))
  
    return mappings[:min(simmatrixarray.shape)]
function_tokens: def getmappings ( simmatrixarray ) : costarray = numpy . ones ( simmatrixarray . shape ) - simmatrixarray it = numpy . nditer ( costarray , flags = [ 'multi_index' ] , op_flags = [ 'writeonly' ] ) dsu = [ ] for a in it : dsu . append ( ( a , it . multi_index [ 0 ] , it . multi_index [ 1 ] ) ) dsu . sort ( ) seena = set ( ) seenb = set ( ) mappings = [ ] for sim , a , b in dsu : if a not in seena and b not in seenb : seena . add ( a ) seenb . add ( b ) mappings . append ( ( a , b ) ) return mappings [ : min ( simmatrixarray . shape ) ]