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>, Error>
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).