Expand description
Sorts the given event graph using reverse topological power ordering.
Definition in the specification:
The reverse topological power ordering of a set of events is the lexicographically smallest topological ordering based on the DAG formed by referenced events (prev or auth, determined by caller). The reverse topological power ordering is ordered from earliest event to latest. For comparing two equal topological orderings to determine which is the lexicographically smallest, the following comparison relation on events is used: for events x and y, x < y if
- x’s sender has greater power level than y’s sender, when looking at their respective referenced events; or
- the senders have the same power level, but x’s origin_server_ts is less than y’s origin_server_ts; or
- the senders have the same power level and the events have the same origin_server_ts, but x’s event_id is less than y’s event_id.
The reverse topological power ordering can be found by sorting the events using Kahn’s algorithm for topological sorting, and at each step selecting, among all the candidate vertices, the smallest vertex using the above comparison relation.
Structs§
Functions§
- is_
topologically_ sorted - Tests whether the events in
orderare in reverse topological power ordering with respect tograph: each event appears after every event it references that is present ingraph. - is_
topologically_ sorted_ in_ place - Whether
itemsare already in reverse topological order, reading each item’s references in place instead of from a prebuilt graph. An item must follow every item it references that is also present amongitems; a reference to an absent item is a non-edge.idreads an item’s identifier,referencesits outgoing references. - kahn_
sort 🔒 - topological_
sort - Sorts the given event graph using reverse topological power ordering.