[−][src]Function sp_phragmen::elect
pub fn elect<AccountId, R>(
candidate_count: usize,
minimum_candidate_count: usize,
initial_candidates: Vec<AccountId>,
initial_voters: Vec<(AccountId, VoteWeight, Vec<AccountId>)>
) -> Option<PhragmenResult<AccountId, R>> where
AccountId: Default + Ord + Clone,
R: PerThing,
Perform election based on Phragmén algorithm.
Returns an Option
the set of winners and their detailed support ratio from each voter if
enough candidates are provided. Returns None
otherwise.
candidate_count
: number of candidates to elect.minimum_candidate_count
: minimum number of candidates to elect. If less candidates exist,None
is returned.initial_candidates
: candidates list to be elected from.initial_voters
: voters list.
This function does not strip out candidates who do not have any backing stake. It is the responsibility of the caller to make sure only those candidates who have a sensible economic value are passed in. From the perspective of this function, a candidate can easily be among the winner with no backing stake.