Function sp_npos_elections::reduce::reduce[][src]

pub fn reduce<A: IdentifierT>(assignments: &mut Vec<StakedAssignment<A>>) -> u32
Expand description

Reduce the given Vec<StakedAssignment<IdentifierT>>. This removes redundant edges from without changing the overall backing of any of the elected candidates.

Returns the number of edges removed.

IMPORTANT: It is strictly assumed that the who attribute of all provided assignments are unique. The result will most likely be corrupt otherwise. Furthermore, if the distribution vector contains duplicate ids, only the first instance is ever updates.

O(min{ |Ew| ⋅ k + m3 , |Ew| ⋅ m })