in reply to Merge lists of ordered strings into canonical ordering

I think a graph approach makes sense, as suggested by Anonymous Monk. I think you can do this using a directed Graph with countedged to record the fact that an ordering has been seen multiple times, then break loops by reducing the weight of all edges in the loop by the minimum of them and removing any edge that reaches zero. It's not immediately obvious to me what should happen when there are multiple intersecting loops - you'd probably need to experiment to find a viable approach for that case.

  • Comment on Re: Merge lists of ordered strings into canonical ordering