Function ruma::state_res::lexicographical_topological_sort
source · [−]pub fn lexicographical_topological_sort<Id, F>(
graph: &HashMap<Id, HashSet<Id, RandomState>, RandomState>,
key_fn: F
) -> Result<Vec<Id, Global>, Error>where
F: Fn(&EventId) -> Result<(Int, MilliSecondsSinceUnixEpoch), Error>,
Id: Clone + Eq + Ord + Hash + Borrow<EventId>,
Available on crate feature
state-res
only.Expand description
Sorts the event graph based on number of outgoing/incoming edges.
key_fn
is used as to obtain the power level and age of an event for breaking ties (together
with the event ID).