ruma_state_res

Function lexicographical_topological_sort

Source
pub fn lexicographical_topological_sort<Id, F>(
    graph: &HashMap<Id, HashSet<Id>>,
    key_fn: F,
) -> Result<Vec<Id>>
where F: Fn(&EventId) -> Result<(Int, MilliSecondsSinceUnixEpoch)>, Id: Clone + Eq + Ord + Hash + Borrow<EventId>,
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).