Rank Aggregation

This is a simple library for rank aggregation: the process of taking a collection of individual preferences amongst items and turning them into a single global ranking.

It was developed for Hammer Principe and is based heavily on Rank Aggregation Revisited, with some minor innovations.

This isn't actually the version that's currently running on the site, but it's similar. I created this to experiment with variations on the algorithm and clean up the code. Eventually the two will be one and the same.

Example usage

The use case this is optimised for is when the number of items is relatively small (say a few hundred) but the number of votes is relatively large.

This can be used either as a command line tool or from within ruby code.

The simpest usage in ruby is as follows:

irb(main):002:0> RankAggregation.combine_rankings [ [1, 2, 3], [1, 2, 4], [3, 4] ] => [1, 2, 3, 4]

This can be any enumerable of enumerables. If you passed it something which streams its items lazily it shouldn't need more than O(number of items to rank^2) memory.

The command line tool takes a list of tab separated rankings (one per line) and outputs a single aggregate ranking in the same format.