-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
6e8ac60
commit 1ed0788
Showing
14 changed files
with
343 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
Oops, something went wrong.