#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

#208 in Data structures

Download history 14841/week @ 2024-11-17 13423/week @ 2024-11-24 24468/week @ 2024-12-01 19120/week @ 2024-12-08 13407/week @ 2024-12-15 4849/week @ 2024-12-22 10383/week @ 2024-12-29 20772/week @ 2025-01-05 17807/week @ 2025-01-12 17261/week @ 2025-01-19 16669/week @ 2025-01-26 20822/week @ 2025-02-02 18630/week @ 2025-02-09 8927/week @ 2025-02-16 11022/week @ 2025-02-23 13268/week @ 2025-03-02

53,190 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