sp-phragmen 2.0.0-rc2

Phragmen primitives
Documentation

Rust implementation of the Phragmén election algorithm. This is used in several pallets to optimally distribute the weight of a set of voters among an elected set of candidates. In the context of staking this is mapped to validators and nominators.

The algorithm has two phases:

  • Sequential phragmen: performed in [elect] function which is first pass of the distribution The results are not optimal but the execution time is less.
  • Equalize post-processing: tries to further distribute the weight fairly among candidates. Incurs more execution time.

The main objective of the assignments done by phragmen is to maximize the minimum backed candidate in the elected set.

Reference implementation: https://github.com/w3f/consensus Further details: https://research.web3.foundation/en/latest/polkadot/NPoS/4.%20Sequential%20Phragm%C3%A9n%E2%80%99s%20method/