Liking cljdoc? Tell your friends :D
Clojure only.

suffragium.runoff


irvclj

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

Perform an election using instant runoff. Every ballot should contain a complete and strict ranking of the candidates. Returns an array map with candidate keys and values of vectors representing the number of votes that candidate had accumulated in each successive round. The map is ordered from most to least preferred candidate.

: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 a complete, but non-specific, order.

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 an array map with
candidate keys and values of vectors representing the number of votes
that candidate had accumulated in each successive round. The map is ordered
from most to least preferred candidate.

: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 a complete, but non-specific, order.

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.
sourceraw docstring

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

× close