Skip to content

Commit

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

- Add the `Sources` trait.
- Add property test `biclique_sources` for `adjacency_list`.
- Add property test `biclique_sources` for `adjacency_matrix`.
- Add property test `circuit_sources` for `adjacency_list`.
- Add property test `circuit_sources` for `adjacency_matrix`.
- Add property test `complete_sources` for `adjacency_list`.
- Add property test `complete_sources` for `adjacency_matrix`.
- Add property test `cycle_sources` for `adjacency_list`.
- Add property test `cycle_sources` for `adjacency_matrix`.
- Add property test `empty_sources` for `adjacency_list`.
- Add property test `empty_sources` for `adjacency_matrix`.
- Add property test `path_sources` for `adjacency_list`.
- Add property test `path_sources` for `adjacency_matrix`.
- Add property test `random_tournament_sources` for `adjacency_list`.
- Add property test `random_tournament_sources` for `adjacency_matrix`.
- Add property test `star_sources` for `adjacency_list`.
- Add property test `star_sources` for `adjacency_matrix`.
- Add unit test `sources_bang_jensen_196` for `adjacency_list`.
- Add unit test `sources_bang_jensen_196` for `adjacency_matrix`.
- Add unit test `sources_bang_jensen_34` for `adjacency_list`.
- Add unit test `sources_bang_jensen_34` for `adjacency_matrix`.
- Add unit test `sources_bang_jensen_94` for `adjacency_list`.
- Add unit test `sources_bang_jensen_94` for `adjacency_matrix`.
- Add unit test `sources_kattis_builddeps` for `adjacency_list`.
- Add unit test `sources_kattis_builddeps` for `adjacency_matrix`.
- Add unit test `sources_kattis_cantinaofbabel_1` for `adjacency_list`.
- Add unit test `sources_kattis_cantinaofbabel_1` for `adjacency_matrix`.
- Add unit test `sources_kattis_cantinaofbabel_2` for `adjacency_list`.
- Add unit test `sources_kattis_cantinaofbabel_2` for `adjacency_matrix`.
- Add unit test `sources_kattis_escapewallmaria_1` for `adjacency_list`.
- Add unit test `sources_kattis_escapewallmaria_1` for `adjacency_matrix`.
- Add unit test `sources_kattis_escapewallmaria_2` for `adjacency_list`.
- Add unit test `sources_kattis_escapewallmaria_2` for `adjacency_matrix`.
- Add unit test `sources_kattis_escapewallmaria_3` for `adjacency_list`.
- Add unit test `sources_kattis_escapewallmaria_3` for `adjacency_matrix`.
  • Loading branch information
basdirks-purple committed Jul 28, 2024
1 parent 5165b73 commit b591e4e
Show file tree
Hide file tree
Showing 10 changed files with 434 additions and 63 deletions.
41 changes: 40 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,53 @@
- Add the `MinIndegree` trait.
- Add the `MinOutdegree` trait.
- Add the `MinSemidegree` trait.
- Add the `Sources` trait.
- Benchmark against popular graph libraries in other languages.
- Benchmark trait implementations.
- 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.3] - 2024-07-28

Added

- Add the `Sources` trait.
- Add property test `biclique_sources` for `adjacency_list`.
- Add property test `biclique_sources` for `adjacency_matrix`.
- Add property test `circuit_sources` for `adjacency_list`.
- Add property test `circuit_sources` for `adjacency_matrix`.
- Add property test `complete_sources` for `adjacency_list`.
- Add property test `complete_sources` for `adjacency_matrix`.
- Add property test `cycle_sources` for `adjacency_list`.
- Add property test `cycle_sources` for `adjacency_matrix`.
- Add property test `empty_sources` for `adjacency_list`.
- Add property test `empty_sources` for `adjacency_matrix`.
- Add property test `path_sources` for `adjacency_list`.
- Add property test `path_sources` for `adjacency_matrix`.
- Add property test `random_tournament_sources` for `adjacency_list`.
- Add property test `random_tournament_sources` for `adjacency_matrix`.
- Add property test `star_sources` for `adjacency_list`.
- Add property test `star_sources` for `adjacency_matrix`.
- Add unit test `sources_bang_jensen_196` for `adjacency_list`.
- Add unit test `sources_bang_jensen_196` for `adjacency_matrix`.
- Add unit test `sources_bang_jensen_34` for `adjacency_list`.
- Add unit test `sources_bang_jensen_34` for `adjacency_matrix`.
- Add unit test `sources_bang_jensen_94` for `adjacency_list`.
- Add unit test `sources_bang_jensen_94` for `adjacency_matrix`.
- Add unit test `sources_kattis_builddeps` for `adjacency_list`.
- Add unit test `sources_kattis_builddeps` for `adjacency_matrix`.
- Add unit test `sources_kattis_cantinaofbabel_1` for `adjacency_list`.
- Add unit test `sources_kattis_cantinaofbabel_1` for `adjacency_matrix`.
- Add unit test `sources_kattis_cantinaofbabel_2` for `adjacency_list`.
- Add unit test `sources_kattis_cantinaofbabel_2` for `adjacency_matrix`.
- Add unit test `sources_kattis_escapewallmaria_1` for `adjacency_list`.
- Add unit test `sources_kattis_escapewallmaria_1` for `adjacency_matrix`.
- Add unit test `sources_kattis_escapewallmaria_2` for `adjacency_list`.
- Add unit test `sources_kattis_escapewallmaria_2` for `adjacency_matrix`.
- Add unit test `sources_kattis_escapewallmaria_3` for `adjacency_list`.
- Add unit test `sources_kattis_escapewallmaria_3` for `adjacency_matrix`.

## [0.75.2] - 2024-07-28

Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "graaf"
version = "0.75.2"
version = "0.75.3"
edition = "2021"
authors = ["Bas Dirks <bas.dirks@protonmail.com>"]
categories = ["algorithms", "data-structures", "mathematics"]
Expand Down
4 changes: 3 additions & 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.2"
graaf = "0.75.3"
```

## Digraph Types
Expand Down Expand Up @@ -107,6 +107,7 @@ The extended traits derive their implementation from the basic operations.
- [`OutdegreeSequence`] returns the outdegree sequence of a digraph.
- [`SemidegreeSequence`] returns the semidegree sequence of a digraph.
- [`Sinks`] returns the sinks in a digraph.
- [`Sources`] returns the sources in a digraph.

## Algorithms

Expand Down Expand Up @@ -241,6 +242,7 @@ A distance matrix contains the shortest distances between all pairs of vertices
[`SemidegreeSequence`]: https://docs.rs/graaf/latest/graaf/op/semidegree_sequence/trait.SemidegreeSequence.html
[`Sinks`]: https://docs.rs/graaf/latest/graaf/op/sinks/trait.Sinks.html
[`Size`]: https://docs.rs/graaf/latest/graaf/op/size/trait.Size.html
[`Sources`]: https://docs.rs/graaf/latest/graaf/op/sources/trait.Sources.html
[`Star`]: https://docs.rs/graaf/latest/graaf/gen/star/trait.Star.html
[`Vertices`]: https://docs.rs/graaf/latest/graaf/op/vertices/trait.Vertices.html
[`algo`]: https://docs.rs/graaf/latest/graaf/algo/index.html
Expand Down
102 changes: 102 additions & 0 deletions src/adjacency_list/digraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ mod tests {
OutdegreeSequence,
SemidegreeSequence,
Sinks,
Sources,
},
proptest_strategy::arc,
r#gen::Path,
Expand Down Expand Up @@ -622,6 +623,11 @@ mod tests {
assert_eq!(Digraph::biclique(m, n).size(), m * n * 2);
}

#[test]
fn biclique_sources(m in 1..25_usize, n in 1..25_usize) {
assert!(Digraph::biclique(m, n).sources().eq([]));
}

#[test]
fn circuit_complement_size(order in 1..25_usize) {
assert_eq!(
Expand Down Expand Up @@ -825,6 +831,14 @@ mod tests {
);
}

#[test]
fn circuit_sources(order in 1..25_usize) {
let digraph = Digraph::circuit(order);
let sources = digraph.sources();

assert!(if order == 1 { sources.eq([0]) } else { sources.eq([]) });
}

#[test]
fn complete_complement_equals_empty(order in 1..25_usize) {
assert_eq!(
Expand Down Expand Up @@ -1021,6 +1035,15 @@ mod tests {
assert_eq!(Digraph::complete(order).size(), order * (order - 1));
}

#[test]
fn complete_sources(order in 1..25_usize) {
assert!(if order == 1 {
Digraph::complete(order).sources().eq([0])
} else {
Digraph::complete(order).sources().eq([])
});
}

#[test]
fn cycle_complement_size(order in 1..25_usize) {
assert_eq!(
Expand Down Expand Up @@ -1241,6 +1264,15 @@ mod tests {
);
}

#[test]
fn cycle_sources(order in 1..25_usize) {
assert!(if order == 1 {
Digraph::cycle(order).sources().eq([0])
} else {
Digraph::cycle(order).sources().eq([])
});
}

#[test]
fn empty_arcs(order in 1..25_usize) {
assert!(Digraph::empty(order).arcs().eq([]));
Expand Down Expand Up @@ -1443,6 +1475,11 @@ mod tests {
assert_eq!(Digraph::empty(order).size(), 0);
}

#[test]
fn empty_sources(order in 1..25_usize) {
assert!(Digraph::empty(order).sources().eq(0..order));
}

#[test]
fn has_arc_out_of_bounds(order in 1..25_usize) {
let digraph = Digraph::empty(order);
Expand Down Expand Up @@ -1667,6 +1704,11 @@ mod tests {
assert_eq!(Digraph::path(order).size(), order - 1);
}

#[test]
fn path_sources(order in 1..25_usize) {
assert!(Digraph::path(order).sources().eq([0]));
}

#[test]
fn random_tournament_complement_size(order in 1..25_usize) {
assert_eq!(
Expand Down Expand Up @@ -2056,6 +2098,15 @@ mod tests {
fn star_size(order in 1..25_usize) {
assert_eq!(Digraph::star(order).size(), (order - 1) * 2);
}

#[test]
fn star_sources(order in 1..25_usize) {
assert!(if order == 1 {
Digraph::star(order).sources().eq([0])
} else {
Digraph::star(order).sources().eq([])
});
}
}

#[test]
Expand Down Expand Up @@ -5602,6 +5653,57 @@ mod tests {
assert_eq!(kattis_escapewallmaria_3().size(), 14);
}

#[test]
fn sources_bang_jensen_196() {
assert!(bang_jensen_196().sources().eq([]));
}

#[test]
fn sources_bang_jensen_34() {
assert!(bang_jensen_34().sources().eq([2]));
}

#[test]
fn sources_bang_jensen_94() {
assert!(bang_jensen_94().sources().eq([0]));
}

#[test]
fn sources_kattis_builddeps() {
assert!(kattis_builddeps().sources().eq([0, 2]));
}

#[test]
fn sources_kattis_cantinaofbabel_1() {
assert!(kattis_cantinaofbabel_1().sources().eq([8]));
}

#[test]
fn sources_kattis_cantinaofbabel_2() {
assert!(kattis_cantinaofbabel_2().sources().eq([]));
}

#[test]
fn sources_kattis_escapewallmaria_1() {
assert!(kattis_escapewallmaria_1()
.sources()
.eq([0, 1, 2, 3, 4, 7, 8, 10, 11]));
}

#[test]
fn sources_kattis_escapewallmaria_2() {
assert!(kattis_escapewallmaria_2()
.sources()
.eq([0, 1, 2, 3, 4, 7, 8, 10, 11]));
}

#[test]
fn sources_kattis_escapewallmaria_3() {
assert!(kattis_escapewallmaria_3()
.sources()
.eq([0, 3, 4, 7, 8, 10, 11]));
}

#[test]
fn star_1() {
assert!(Digraph::star(1).arcs().eq([]));
Expand Down
60 changes: 30 additions & 30 deletions src/adjacency_list/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,16 @@ pub fn kattis_cantinaofbabel_2() -> Digraph {
/// <https://open.kattis.com/problems/escapewallmaria>
///
/// ```text
/// 0 -> {}
/// 1 -> {}
/// 2 -> {}
/// 3 -> {}
/// 4 -> {}
/// 5 -> {6, 9}
/// 6 -> {5}
/// 7 -> {}
/// 8 -> {}
/// 9 -> {5, 13}
/// 0 -> {}
/// 1 -> {}
/// 2 -> {}
/// 3 -> {}
/// 4 -> {}
/// 5 -> {6, 9}
/// 6 -> {5}
/// 7 -> {}
/// 8 -> {}
/// 9 -> {5, 13}
/// 10 -> {}
/// 11 -> {}
/// 12 -> {}
Expand Down Expand Up @@ -277,16 +277,16 @@ pub fn kattis_escapewallmaria_1() -> Digraph {
/// <https://open.kattis.com/problems/escapewallmaria>
///
/// ```text
/// 0 -> {}
/// 1 -> {}
/// 2 -> {}
/// 3 -> {}
/// 4 -> {}
/// 5 -> {6, 9}
/// 6 -> {5}
/// 7 -> {}
/// 8 -> {}
/// 9 -> {5}
/// 0 -> {}
/// 1 -> {}
/// 2 -> {}
/// 3 -> {}
/// 4 -> {}
/// 5 -> {6, 9}
/// 6 -> {5}
/// 7 -> {}
/// 8 -> {}
/// 9 -> {5}
/// 10 -> {}
/// 11 -> {}
/// 12 -> {13}
Expand Down Expand Up @@ -316,16 +316,16 @@ pub fn kattis_escapewallmaria_2() -> Digraph {
/// <https://open.kattis.com/problems/escapewallmaria>
///
/// ```text
/// 0 -> {}
/// 1 -> {2, 5}
/// 2 -> {1, 6}
/// 3 -> {}
/// 4 -> {}
/// 5 -> {1, 6, 9}
/// 6 -> {2, 5}
/// 7 -> {}
/// 8 -> {}
/// 9 -> {5, 13}
/// 0 -> {}
/// 1 -> {2, 5}
/// 2 -> {1, 6}
/// 3 -> {}
/// 4 -> {}
/// 5 -> {1, 6, 9}
/// 6 -> {2, 5}
/// 7 -> {}
/// 8 -> {}
/// 9 -> {5, 13}
/// 10 -> {}
/// 11 -> {}
/// 12 -> {13}
Expand Down
Loading

0 comments on commit b591e4e

Please sign in to comment.