Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 1.36 KB

README.md

File metadata and controls

19 lines (12 loc) · 1.36 KB

Ranked Pairs Voting

Definition

This is a Rust implementation of T.N. Tideman's Ranked Pairs algorithm, with test cases provided by the example given in the Wikipedia article. The goal of the ranked pair election/ballot is to select a winner amongst a list of preferences. It generates a sorted list of pairs and ensures that at least one candidate wins amongst all the possible choices. The procedure first tallies and compares each pair of candidates (choices) and determines a winner. Then these majorities are sorted, in descending order of magnitude from greatest to least. A "lock-in" graph is created, where the largest magnitude majority is considered first to create a DAG in which the source (i.e. the node with no incoming edges) is the winner. In the possiblity of a tie, where there is one or more source nodes, a winner is selected at random amongst them.

Citations

Quickstart

cargo build cargo run -- examples/wiki.json to see full working example with announced winner.

To run unit tests: cargo test