#directed-acyclic-graph #priority #conflict #edge #node #order #lazily

prio-graph

A lazily populated directed acyclic graph with top-level priority ordering

3 unstable releases

0.2.1 Dec 28, 2023
0.2.0 Nov 27, 2023
0.1.0 Oct 9, 2023

#225 in Data structures

Download history 10051/week @ 2024-01-14 13497/week @ 2024-01-21 4338/week @ 2024-01-28 6602/week @ 2024-02-04 4647/week @ 2024-02-11 10981/week @ 2024-02-18 11712/week @ 2024-02-25 11866/week @ 2024-03-03 12390/week @ 2024-03-10 13895/week @ 2024-03-17 12050/week @ 2024-03-24 13902/week @ 2024-03-31 14816/week @ 2024-04-07 15579/week @ 2024-04-14 16032/week @ 2024-04-21 12468/week @ 2024-04-28

60,465 downloads per month
Used in 20 crates (2 directly)

Custom license

24KB
428 lines

prio-graph example workflow

A library for building a directed acyclic graph that is lazily evaluated as new transactions are added. Edges are only present for the next-highest priority conflict for a particular resource, with the caveat that insertion order takes precedence over priority.

The PrioGraph structure keeps track of the nodes in the graph, the directed edges between them, a main queue, and mappings for distinct "chains" of transaction. For example:

graph LR;
A((A)) --> B((B)) --> C((C)) & D((D));
E((E)) --> F((F));

A and E have no conflicts and are the highest priority items within their prospective chains. These node's associated ids would be in the main queue, and would have different chain ids. If a transaction were added that conflicts with both chains, then these chains would be joined, and a mapping of joined chains is tracked in the PrioGraph.

graph LR;
A((A)) --> B((B)) --> C((C)) & D((D)) --> G((G));
E((E)) --> F((F)) --> G;

No runtime deps