What is the best algorithm to use for tournament ranking where every winner also "autowins" every win of the loser?

57 Views Asked by At

Let's say I have a tournament where I need to get a complete ranking of all players at the end of the tournament. The rule of the ranking is that if player A wins player B, then they also win every competition where player B wins (or has already won) every other player automatically.

So, if there are these players: John, Mike, Matt, Mary, Lisa

Then at minimum you need 4 duels: John wins Mike; Mike wins Matt; Matt wins Mary; Mary wins Lisa.

But it can also be 10 duels, if duels take place in a different order: John wins Lisa; John wins Mary; John wins Matt; John wins Mike; Mike wins Lisa; Mike wins Mary; Mike wins Matt; Matt wins Lisa; Matt wins Mary; Mary wins Lisa;

As such, what kind of algorithm would be the quickest and require the least amount of comparisons? 4 is obviously the least amount of duels, but that would rarely happen - same with 10. But in case the 5 participants increased to let's say 50 or 500 the amount of duels is notably different.

Can anyone give a recommendation?