Liking cljdoc? Tell your friends :D
Clojure only.

suffragium.runoff


irvclj

(irv ballots
     &
     {:keys [tbrc all-rounds]
      :or {tbrc (-> ballots first keys sort vec) all-rounds false}})

Perform an election using instant runoff. Every ballot should contain a complete and strict ranking of the candidates. Returns a priority map with candidate keys and values of vectors representing the number of votes that candidate had accumulated in each successive round.

:tbrc specifies the order ties should be broken in favour of when eliminating candidates. Should be a vector of all candidates from most preferred (to win a tie) to least preferred. Defaults to the result of sort on the candidates.

If :all-rounds is true (default: false) the runoff until all but one candidates have been eliminated. Otherwise the runoff will stop once a candidate reaches a majority.

Perform an election using instant runoff. Every ballot should contain a
complete and strict ranking of the candidates. Returns a priority map with
candidate keys and values of vectors representing the number of votes
that candidate had accumulated in each successive round.

:tbrc specifies the order ties should be broken in favour of when eliminating
candidates. Should be a vector of all candidates from most preferred (to win
a tie) to least preferred. Defaults to the result of sort on the candidates.

If :all-rounds is true (default: false) the runoff until all but one
candidates have been eliminated. Otherwise the runoff will stop once a
candidate reaches a majority.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close