#directed-acyclic-graph #directed-graph #priority #priority-queue #transaction #node #conflict

prio-graph

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

4 releases (2 breaking)

0.3.0 Oct 21, 2024
0.2.1 Dec 28, 2023
0.2.0 Nov 27, 2023
0.1.0 Oct 9, 2023

#219 in Data structures

Download history 17066/week @ 2024-10-18 18433/week @ 2024-10-25 18319/week @ 2024-11-01 17513/week @ 2024-11-08 16522/week @ 2024-11-15 14893/week @ 2024-11-22 19679/week @ 2024-11-29 21555/week @ 2024-12-06 14992/week @ 2024-12-13 6188/week @ 2024-12-20 7305/week @ 2024-12-27 18671/week @ 2025-01-03 19876/week @ 2025-01-10 16899/week @ 2025-01-17 17584/week @ 2025-01-24 16689/week @ 2025-01-31

74,384 downloads per month
Used in 27 crates (2 directly)

Custom license

24KB
410 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,.

The PrioGraph structure keeps track of the nodes in the graph, the directed edges between them, and a main queue. 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. If a transaction were added that conflicts with both chains, then these chains would be joined.

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

Dependencies

~0.7–1MB
~13K SLoC