Skip to content

Commit

Permalink
release: 0.75.5
Browse files Browse the repository at this point in the history
Added

- Add benchmark `biclique`.
- Add benchmark `circuit`.
- Add benchmark `complete`.
- Add benchmark `cycle`.
- Add benchmark `empty`.
- Add benchmark `path`.
- Add benchmark `random_tournament`.
- Add benchmark `star`.
- Add property test `random_tournament_has_arc` for `adjacency_list`.
- Add property test `random_tournament_has_arc` for `adjacency_matrix`.

Changed

- Improve performance of `Biclique::biclique` for `adjacency_list`.
- Remove `sample_size` attribute from `single_source_distances` benchmarks.
  • Loading branch information
basdirks-purple committed Aug 3, 2024
1 parent 6e8ac60 commit 1ed0788
Show file tree
Hide file tree
Showing 14 changed files with 343 additions and 49 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,26 @@
- Implement `Debug` for `adjacency_list::Digraph` to show arcs.
- Implement `Debug` for `adjacency_list_weighted::Digraph` to show arcs.
- Implement `Debug` for `adjacency_matrix::Digraph` to show arcs.
- Subsume traits with one super trait into the super trait?

## [0.75.5] - 2024-08-03

Added

- Add benchmark `biclique`.
- Add benchmark `circuit`.
- Add benchmark `complete`.
- Add benchmark `cycle`.
- Add benchmark `empty`.
- Add benchmark `path`.
- Add benchmark `random_tournament`.
- Add benchmark `star`.
- Add property test `random_tournament_has_arc` for `adjacency_list`.
- Add property test `random_tournament_has_arc` for `adjacency_matrix`.

Changed

- Improve performance of `Biclique::biclique` for `adjacency_list`.
- Remove `sample_size` attribute from `single_source_distances` benchmarks.

## [0.75.4] - 2024-07-30

Expand Down
44 changes: 41 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "graaf"
version = "0.75.4"
version = "0.75.5"
edition = "2021"
authors = ["Bas Dirks <bas.dirks@protonmail.com>"]
categories = ["algorithms", "data-structures", "mathematics"]
Expand All @@ -11,8 +11,6 @@ license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/bsdrks/graaf"

[dependencies]

[lib]

[dev-dependencies]
Expand All @@ -22,6 +20,46 @@ proptest = "1.4.0"
[profile.test.package.proptest]
opt-level = 3

[[bench]]
name = "biclique"
path = "benches/gen/biclique.rs"
harness = false

[[bench]]
name = "circuit"
path = "benches/gen/circuit.rs"
harness = false

[[bench]]
name = "complete"
path = "benches/gen/complete.rs"
harness = false

[[bench]]
name = "cycle"
path = "benches/gen/cycle.rs"
harness = false

[[bench]]
name = "empty"
path = "benches/gen/empty.rs"
harness = false

[[bench]]
name = "path"
path = "benches/gen/path.rs"
harness = false

[[bench]]
name = "random_tournament"
path = "benches/gen/random_tournament.rs"
harness = false

[[bench]]
name = "star"
path = "benches/gen/star.rs"
harness = false

[[bench]]
name = "single_source_distances"
path = "benches/algo/single_source_distances.rs"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Add the following to your `Cargo.toml`:

```toml
[dependencies]
graaf = "0.75.4"
graaf = "0.75.5"
```

## Digraph Types
Expand Down
9 changes: 0 additions & 9 deletions benches/algo/single_source_distances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ fn main() {
divan::main();
}

#[divan::bench_group(sample_size = 1000)]
mod bang_jensen_94 {
use super::*;

Expand Down Expand Up @@ -62,7 +61,6 @@ mod bang_jensen_94 {
}
}

#[divan::bench_group(sample_size = 1000)]
mod bang_jensen_96 {
use super::*;

Expand All @@ -89,7 +87,6 @@ mod bang_jensen_96 {
}
}

#[divan::bench_group(sample_size = 1000)]
mod bang_jensen_99 {
use super::*;

Expand All @@ -105,7 +102,6 @@ mod bang_jensen_99 {
}
}

#[divan::bench_group(sample_size = 1000)]
mod kattis_bryr_1 {
use super::*;

Expand All @@ -132,7 +128,6 @@ mod kattis_bryr_1 {
}
}

#[divan::bench_group(sample_size = 1000)]
mod kattis_bryr_2 {
use super::*;

Expand All @@ -159,7 +154,6 @@ mod kattis_bryr_2 {
}
}

#[divan::bench_group(sample_size = 1000)]
mod kattis_bryr_3 {
use super::*;

Expand All @@ -186,7 +180,6 @@ mod kattis_bryr_3 {
}
}

#[divan::bench_group(sample_size = 1000)]
mod kattis_crosscountry {
use super::*;

Expand Down Expand Up @@ -214,7 +207,6 @@ mod kattis_crosscountry {
}
}

#[divan::bench_group(sample_size = 1000)]
mod kattis_shortestpath1 {
use super::*;

Expand Down Expand Up @@ -242,7 +234,6 @@ mod kattis_shortestpath1 {
}
}

#[divan::bench_group(sample_size = 1000)]
mod random_tournament {
use {
divan::Bencher,
Expand Down
76 changes: 76 additions & 0 deletions benches/gen/biclique.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//! Benchmark the `Biclique::biclique` implementation for different types.
use graaf::{
adjacency_list,
adjacency_matrix,
gen::Biclique,
op::AddArc,
r#gen::Empty,
};

fn main() {
divan::main();
}

/// # Panics
///
/// * Panics if `m` is zero.
/// * Panics if `n` is zero.
fn biclique_adjacency_list_naive(
m: usize,
n: usize,
) -> adjacency_list::Digraph {
assert!(m > 0, "m must be greater than zero");
assert!(n > 0, "n must be greater than zero");

let order = m + n;
let mut digraph = adjacency_list::Digraph::empty(order);

for u in 0..m {
for v in m..order {
digraph.add_arc(u, v);
digraph.add_arc(v, u);
}
}

digraph
}

#[divan::bench(args = [
(10, 10),
(10, 100),
(10, 1000),
(10, 10000),
(100, 100),
(100, 1000),
(100, 10000),
])]
fn adjacency_list_naive((m, n): (usize, usize)) {
let _ = biclique_adjacency_list_naive(m, n);
}

#[divan::bench(args = [
(10, 10),
(10, 100),
(10, 1000),
(10, 10000),
(100, 100),
(100, 1000),
(100, 10000),
])]
fn adjacency_list((m, n): (usize, usize)) {
let _ = adjacency_list::Digraph::biclique(m, n);
}

#[divan::bench(args = [
(10, 10),
(10, 100),
(10, 1000),
(10, 10000),
(100, 100),
(100, 1000),
(100, 10000),
])]
fn adjacency_matrix((m, n): (usize, usize)) {
let _ = adjacency_matrix::Digraph::biclique(m, n);
}
21 changes: 21 additions & 0 deletions benches/gen/circuit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Benchmark the `Circuit::circuit` implementation for different types.
use graaf::{
adjacency_list,
adjacency_matrix,
gen::Circuit,
};

fn main() {
divan::main();
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_list(n: usize) {
let _ = adjacency_list::Digraph::circuit(n);
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_matrix(n: usize) {
let _ = adjacency_matrix::Digraph::circuit(n);
}
21 changes: 21 additions & 0 deletions benches/gen/complete.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Benchmark the `Complete::complete` implementation for different types.
use graaf::{
adjacency_list,
adjacency_matrix,
gen::Complete,
};

fn main() {
divan::main();
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_list(n: usize) {
let _ = adjacency_list::Digraph::complete(n);
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_matrix(n: usize) {
let _ = adjacency_matrix::Digraph::complete(n);
}
21 changes: 21 additions & 0 deletions benches/gen/cycle.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Benchmark the `Cycle::cycle` implementation for different types.
use graaf::{
adjacency_list,
adjacency_matrix,
gen::Cycle,
};

fn main() {
divan::main();
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_list(n: usize) {
let _ = adjacency_list::Digraph::cycle(n);
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_matrix(n: usize) {
let _ = adjacency_matrix::Digraph::cycle(n);
}
21 changes: 21 additions & 0 deletions benches/gen/empty.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Benchmark the `Empty::empty` implementation for different types.
use graaf::{
adjacency_list,
adjacency_matrix,
gen::Empty,
};

fn main() {
divan::main();
}

#[divan::bench(args = [10, 100, 1000, 10000])]
fn adjacency_list(n: usize) {
let _ = adjacency_list::Digraph::empty(n);
}

#[divan::bench(args = [10, 100, 1000, 10000])]
fn adjacency_matrix(n: usize) {
let _ = adjacency_matrix::Digraph::empty(n);
}
21 changes: 21 additions & 0 deletions benches/gen/path.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Benchmark the `Path::path` implementation for different types.
use graaf::{
adjacency_list,
adjacency_matrix,
gen::Path,
};

fn main() {
divan::main();
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_list(n: usize) {
let _ = adjacency_list::Digraph::path(n);
}

#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
fn adjacency_matrix(n: usize) {
let _ = adjacency_matrix::Digraph::path(n);
}
22 changes: 22 additions & 0 deletions benches/gen/random_tournament.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//! Benchmark the `RandomTournament::random_tournament` implementation for
//! different types.
use graaf::{
adjacency_list,
adjacency_matrix,
gen::RandomTournament,
};

fn main() {
divan::main();
}

#[divan::bench(args = [10, 100, 1000])]
fn adjacency_list(n: usize) {
let _ = adjacency_list::Digraph::random_tournament(n);
}

#[divan::bench(args = [10, 100, 1000])]
fn adjacency_matrix(n: usize) {
let _ = adjacency_matrix::Digraph::random_tournament(n);
}
Loading

0 comments on commit 1ed0788

Please sign in to comment.