Hungarian or Kuhn-Munkres algorithm (good description here) pairs objects from two sets (of n and m objects respectively, n>=m) so that the overall \"
Maybe your approach is wrong but the hungarian algorithm is only for bipartite graph. For a general (non-bipartite) graph (i.e. weigthed matching) look here http://en.wikipedia.org/wiki/Edmonds%27s_matching_algorithm. Or you want to cheat and you give only the top ten of the maximum-cost pair matching?