Find the maximum of an intransitive set, with minimum comparisons

103 Views Asked by At

An intransitive set can have members A B and C where A > B > C but C > A. Such a set might be photos ordered by a person's preference.

I can relatively easily find algorithms for finding the maximum of a transitive set with minimal work, and even for sorting an intransitive set, but it's hard to see how to combine the two.

Is there a known solution for this problem?

1

There are 1 best solutions below

1
On

What you have is basically a preorder, which can be represented by a directed graph. Since it's not acylcic, there isn't a unique sort. But you can perform a depth first traversal, which will give you the topological ordering of some subforest of the graph.

You can also find the strongly connected components through various algorithms (Tarjan's is my favorite).