Skip to content

corydickson/pairwise-voting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rust implementation of Tideman Ranked Pairs system

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages