1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! Check whether a digraph is regular.
//!
//! A digraph is regular if all vertices have the same indegree and
//! outdegree.
//!
//! # Examples
//!
//! ```
//! use graaf::{
//! AdjacencyList,
//! Circuit,
//! IsRegular,
//! RemoveArc,
//! };
//!
//! let mut digraph = AdjacencyList::circuit(7);
//!
//! assert!(digraph.is_regular());
//!
//! digraph.remove_arc(6, 0);
//!
//! assert!(!digraph.is_regular());
//! ```
/// Check whether a digraph is regular.
pub trait IsRegular {
/// Check whether the digraph is regular.
///
/// # Examples
///
/// ```
/// use graaf::{
/// AdjacencyList,
/// Circuit,
/// IsRegular,
/// RemoveArc,
/// };
///
/// let mut digraph = AdjacencyList::circuit(7);
///
/// assert!(digraph.is_regular());
///
/// digraph.remove_arc(6, 0);
///
/// assert!(!digraph.is_regular());
/// ```
#[must_use]
fn is_regular(&self) -> bool;
}
/// `IsRegular` tests
#[macro_export]
macro_rules! test_is_regular {
($fixture:path) => {
use $fixture::{
bang_jensen_34,
bang_jensen_94,
bang_jensen_196,
kattis_builddeps,
kattis_cantinaofbabel_1,
kattis_cantinaofbabel_2,
kattis_escapewallmaria_1,
kattis_escapewallmaria_2,
kattis_escapewallmaria_3,
};
#[test]
fn is_regular_bang_jensen_196() {
assert!(!bang_jensen_196().is_regular());
}
#[test]
fn is_regular_bang_jensen_34() {
assert!(!bang_jensen_34().is_regular());
}
#[test]
fn is_regular_bang_jensen_94() {
assert!(!bang_jensen_94().is_regular());
}
#[test]
fn is_regular_kattis_builddeps() {
assert!(!kattis_builddeps().is_regular());
}
#[test]
fn is_regular_kattis_cantinaofbabel_1() {
assert!(!kattis_cantinaofbabel_1().is_regular());
}
#[test]
fn is_regular_kattis_cantinaofbabel_2() {
assert!(!kattis_cantinaofbabel_2().is_regular());
}
#[test]
fn is_regular_kattis_escapewallmaria_1() {
assert!(!kattis_escapewallmaria_1().is_regular());
}
#[test]
fn is_regular_kattis_escapewallmaria_2() {
assert!(!kattis_escapewallmaria_2().is_regular());
}
#[test]
fn is_regular_kattis_escapewallmaria_3() {
assert!(!kattis_escapewallmaria_3().is_regular());
}
};
}