summaryrefslogtreecommitdiff
path: root/graph-checker/src/theorems/toughness.rs
diff options
context:
space:
mode:
authorAndrew Guschin <guschin.drew@gmail.com>2023-04-09 18:23:13 +0400
committerAndrew Guschin <guschin.drew@gmail.com>2023-04-09 18:23:13 +0400
commita5bf84189c0df8a2ac5a6f99ca314a1f39c9b697 (patch)
treef5386fffa1db8fab5e0fe2cced0470db999c5aed /graph-checker/src/theorems/toughness.rs
parentcf1396c9ac9a37d5f5b0821f1572be17bcca3aa7 (diff)
Restructured project into multiple files
Diffstat (limited to 'graph-checker/src/theorems/toughness.rs')
-rw-r--r--graph-checker/src/theorems/toughness.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/graph-checker/src/theorems/toughness.rs b/graph-checker/src/theorems/toughness.rs
new file mode 100644
index 0000000..e659901
--- /dev/null
+++ b/graph-checker/src/theorems/toughness.rs
@@ -0,0 +1,17 @@
+use crate::Graph;
+
+pub fn theorem15(g: &Graph, toughness: f64, min_degree: f64) -> bool {
+ let max_ind_cutset_size = g.max_independent_cutset().cardinality as f64;
+ let third_of_size = g.size as f64 / 3.0;
+ let tmp = if third_of_size > max_ind_cutset_size - 1.0 {
+ third_of_size
+ } else {
+ max_ind_cutset_size - 1.0
+ };
+
+ return toughness >= 1.0 && min_degree >= tmp;
+}
+
+pub fn theorem25(g: &Graph, toughness: f64, min_degree: f64) -> bool {
+ return min_degree > g.size as f64 / (toughness + 1.0) - 1.0;
+}