Skip to content

Commit fce8312

Browse files
committed
advertise MSRV
1 parent 075423b commit fce8312

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0"
99
repository = "https://github.com/orxfun/orx-priority-queue/"
1010
keywords = ["priority", "queue", "heap", "dary", "binary"]
1111
categories = ["algorithms", "data-structures", "mathematics", "no-std"]
12+
rust-version = "1.88"
1213

1314
[features]
1415
default = ["std"]

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
[![orx-priority-queue crate](https://img.shields.io/crates/v/orx-priority-queue.svg)](https://crates.io/crates/orx-priority-queue)
44
[![orx-priority-queue crate](https://img.shields.io/crates/d/orx-priority-queue.svg)](https://crates.io/crates/orx-priority-queue)
55
[![orx-priority-queue documentation](https://docs.rs/orx-priority-queue/badge.svg)](https://docs.rs/orx-priority-queue)
6+
[![MSRV](https://img.shields.io/badge/MSRV-1.88.0-blue)](https://releases.rs/docs/1.88.0/)
67

78
Priority queue traits and high performance d-ary heap implementations.
89

9-
> **no-std**: This crate supports **no-std**; however, *std* is added as a default feature. Please include with **no-default-features** for no-std use cases: `cargo add orx-priority-queue --no-default-features`.
10+
> **no-std**: This crate supports **no-std**; however, _std_ is added as a default feature. Please include with **no-default-features** for no-std use cases: `cargo add orx-priority-queue --no-default-features`.
1011
1112
## A. Priority Queue Traits
1213

@@ -19,8 +20,9 @@ See [DecreaseKey](https://github.com/orxfun/orx-priority-queue/blob/main/docs/De
1920
## B. d-ary Heap Implementations
2021

2122
d-ary implementations are generalizations of the binary heap; i.e., binary heap is a special case where `D=2`. It is advantageous to have a parametrized d; as for instance, in the benchmarks defined here, `D=4` outperforms `D=2`.
22-
* With a large d: number of per level comparisons increases while the tree depth becomes smaller.
23-
* With a small d: each level requires fewer comparisons while the tree with the same number of nodes is deeper.
23+
24+
- With a large d: number of per level comparisons increases while the tree depth becomes smaller.
25+
- With a small d: each level requires fewer comparisons while the tree with the same number of nodes is deeper.
2426

2527
Further, three categories of d-ary heap implementations are introduced.
2628

@@ -32,8 +34,8 @@ This is the basic d-ary heap implementing `PriorityQueue`. It is the default cho
3234

3335
This is a d-ary heap paired up with a positions array and implements `PriorityQueueDecKey`.
3436

35-
* It requires the nodes to implement `HasIndex` trait which is nothing but `fn index(&self) -> usize`. Note that `usize`, `u64`, etc., already implements `HasIndex`.
36-
* Further, it requires to know the maximum index that is expected to enter the queue. In other words, candidates are expected to come from a closed set.
37+
- It requires the nodes to implement `HasIndex` trait which is nothing but `fn index(&self) -> usize`. Note that `usize`, `u64`, etc., already implements `HasIndex`.
38+
- Further, it requires to know the maximum index that is expected to enter the queue. In other words, candidates are expected to come from a closed set.
3739

3840
Once these conditions are satisfied, it **performs significantly faster** than the alternative decrease key queues.
3941

@@ -51,30 +53,29 @@ This is the most general decrease-key queue that provides the open-set flexibili
5153

5254
In addition, queue implementations are provided in this crate for the following external data structures:
5355

54-
* `std::collections::BinaryHeap<(N, K)>` implements only `PriorityQueue<N, K>`,
55-
* `priority_queue:PriorityQueue<N, K>` implements both `PriorityQueue<N, K>` and `PriorityQueueDecKey<N, K>`
56-
* requires `--features impl_priority_queue`
57-
* or `--features impl_all`
56+
- `std::collections::BinaryHeap<(N, K)>` implements only `PriorityQueue<N, K>`,
57+
- `priority_queue:PriorityQueue<N, K>` implements both `PriorityQueue<N, K>` and `PriorityQueueDecKey<N, K>`
58+
- requires `--features impl_priority_queue`
59+
- or `--features impl_all`
5860

5961
This allows to use all the queue implementations interchangeably and pick the one fitting best to the use case.
6062

6163
### Performance & Benchmarks
6264

63-
*You may find the details of the benchmarks at [benches](https://github.com/orxfun/orx-priority-queue/blob/main/benches) folder.*
65+
_You may find the details of the benchmarks at [benches](https://github.com/orxfun/orx-priority-queue/blob/main/benches) folder._
6466

6567
<img src="https://raw.githubusercontent.com/orxfun/orx-priority-queue/main/docs/bench_results.PNG" alt="https://raw.githubusercontent.com/orxfun/orx-priority-queue/main/docs/bench_results.PNG" />
6668

6769
The table above summarizes the benchmark results of basic operations on basic queues, and queues allowing decrease key operations.
6870

69-
* In the first benchmark, we repeatedly call `push` and `pop` operations on a queue while maintaining an average length of 100000:
70-
* We observe that `BinaryHeap` (`DaryHeap<_, _, 2>`) performs almost the same as the standard binary heap.
71-
* Experiments on different values of d shows that `QuaternaryHeap` (D=4) outperforms both binary heaps.
72-
* Further increasing D to 8 does not improve performance.
73-
* Finally, we repeat the experiments with `BinaryHeap` and `QuaternaryHeap` using the specialized [`push_then_pop`](https://docs.rs/orx-priority-queue/latest/orx_priority_queue/trait.PriorityQueue.html#tymethod.push_then_pop) operation. Note that this operation further doubles the performance, and hence, should be used whenever it fits the use case.
74-
* In the second benchmark, we add [`decrease_key_or_push`](https://docs.rs/orx-priority-queue/latest/orx_priority_queue/trait.PriorityQueueDecKey.html#method.decrease_key_or_push) calls to the operations. Standard binary heap is excluded since it cannot implement `PriorityQueueDecKey`.
75-
* We observe that `DaryHeapOfIndices` significantly outperforms other decrease key queues.
76-
* Among `BinaryHeapOfIndices` and `QuaternaryHeapOfIndices`, the latter with D=4 again performs better.
77-
71+
- In the first benchmark, we repeatedly call `push` and `pop` operations on a queue while maintaining an average length of 100000:
72+
- We observe that `BinaryHeap` (`DaryHeap<_, _, 2>`) performs almost the same as the standard binary heap.
73+
- Experiments on different values of d shows that `QuaternaryHeap` (D=4) outperforms both binary heaps.
74+
- Further increasing D to 8 does not improve performance.
75+
- Finally, we repeat the experiments with `BinaryHeap` and `QuaternaryHeap` using the specialized [`push_then_pop`](https://docs.rs/orx-priority-queue/latest/orx_priority_queue/trait.PriorityQueue.html#tymethod.push_then_pop) operation. Note that this operation further doubles the performance, and hence, should be used whenever it fits the use case.
76+
- In the second benchmark, we add [`decrease_key_or_push`](https://docs.rs/orx-priority-queue/latest/orx_priority_queue/trait.PriorityQueueDecKey.html#method.decrease_key_or_push) calls to the operations. Standard binary heap is excluded since it cannot implement `PriorityQueueDecKey`.
77+
- We observe that `DaryHeapOfIndices` significantly outperforms other decrease key queues.
78+
- Among `BinaryHeapOfIndices` and `QuaternaryHeapOfIndices`, the latter with D=4 again performs better.
7879

7980
## C. Examples
8081

@@ -175,8 +176,8 @@ test_priority_queue_deckey(QuaternaryHeapWithMap::default());
175176

176177
You may see below two implementations of the Dijkstra's shortest path algorithm: one using a `PriorityQueue` and the other with a `PriorityQueueDecKey`. Please note the following:
177178

178-
* Priority queue traits allow us to be generic over queues. Therefore, we are able to implement the algorithm once that works for any queue implementation.
179-
* The second implementation with a decrease key queue pushes some of the bookkeeping to the queue, and arguably leads to a cleaner algorithm implementation.
179+
- Priority queue traits allow us to be generic over queues. Therefore, we are able to implement the algorithm once that works for any queue implementation.
180+
- The second implementation with a decrease key queue pushes some of the bookkeeping to the queue, and arguably leads to a cleaner algorithm implementation.
180181

181182
```rust
182183
use orx_priority_queue::*;

0 commit comments

Comments
 (0)