votes
    Preparing search index...

    Class RankedPairs<C>

    By default, equal-strength pairs are locked simultaneously: if they would form a cycle among themselves, none are locked (most neutral outcome).

    Pass edgeSorter to process equal-strength pairs sequentially instead — the sorter determines which pairs are locked first. byTotalParticipation (exported from this module) is a ready-made sorter that prefers pairs where more voters expressed a preference. Sequential processing matches the canonical Tideman algorithm but makes the result order-dependent when the sorter cannot distinguish all tied pairs.

    The Edge type passed to the sorter has { from, to, value, total }.

    Type Parameters

    • C extends string

    Hierarchy

    • MatrixScoreMethod<C>
      • RankedPairs
    Index
    candidates: C[]
    isRandom: boolean = false
    needsBallot: boolean = false
    needsMatrix: true
    • Returns C[][]

    • Ranking built by repeated wins instead of the method's own full ranking: run the method, record the winning tier, then re-run it restricted to the remaining candidates for the next place, and so on.

      Differs from ranking() whenever the method's full ranking disagrees with how it ranks subsets — e.g. instant runoff orders losers by elimination time, while iterating re-elects a winner at every place.

      Returns C[][]

    • Result of the vote. The first item lists the winners of the vote.

      For example this ranking means that Bear wins, Sheep is second and Lion third [ [ 'Bear' ], [ 'Sheep' ], [ 'Lion' ] ]

      Returns C[][]

    • Type Parameters

      • D extends string

      Parameters

      • candidates: D[]

      Returns D[][]