#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

#209 in Data structures

Download history 16838/week @ 2024-08-22 13071/week @ 2024-08-29 13778/week @ 2024-09-05 9027/week @ 2024-09-12 7944/week @ 2024-09-19 11595/week @ 2024-09-26 13526/week @ 2024-10-03 16029/week @ 2024-10-10 17049/week @ 2024-10-17 19202/week @ 2024-10-24 16986/week @ 2024-10-31 16075/week @ 2024-11-07 19099/week @ 2024-11-14 16200/week @ 2024-11-21 16607/week @ 2024-11-28 18473/week @ 2024-12-05

73,255 downloads per month
Used in 26 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