summaryrefslogtreecommitdiff
path: root/graph-checker/src/main.rs
diff options
context:
space:
mode:
authorAndrew Guschin <guschin.drew@gmail.com>2023-04-19 09:00:11 +0400
committerAndrew Guschin <guschin.drew@gmail.com>2023-04-19 09:00:11 +0400
commit611180cde1b65e5e809e8bad94cb4dc6e858b608 (patch)
treeab0697f04721514f5ce1729080b8c4c33630e666 /graph-checker/src/main.rs
parent30b7dc646f262ec6d97ac701859d0cf9008816c9 (diff)
Added theorems from Gould 2003
Diffstat (limited to 'graph-checker/src/main.rs')
-rw-r--r--graph-checker/src/main.rs159
1 files changed, 94 insertions, 65 deletions
diff --git a/graph-checker/src/main.rs b/graph-checker/src/main.rs
index b3d8602..351fe42 100644
--- a/graph-checker/src/main.rs
+++ b/graph-checker/src/main.rs
@@ -55,83 +55,112 @@ fn main() {
let closure = g.get_closure();
let is_complete = closure.is_complete();
- let toughness = if g.is_complete() {
- f64::MAX
- } else {
- g.get_toughness()
- };
+ // let toughness = if g.is_complete() {
+ // f64::MAX
+ // } else {
+ // g.get_toughness()
+ // };
- if toughness >= 1.0 {
- counters.tough_1 += 1;
- }
- if toughness >= 2.0 {
- counters.tough_2 += 1;
- }
+ // if toughness >= 1.0 {
+ // counters.tough_1 += 1;
+ // }
+ // if toughness >= 2.0 {
+ // counters.tough_2 += 1;
+ // }
- let min_degree = g.min_degree() as f64;
+ // let min_degree = g.min_degree() as f64;
// TODO: add counter
- if forbidden::theorem3_1(&g) {
- println!("g6:t3_1:{}", line);
- }
+ // if forbidden::theorem3_1(&g) {
+ // println!("g6:t3_1:{}", line);
+ // }
- if theorem15(&g, toughness, min_degree) {
- counters.t15_hamiltonian += 1;
- println!("g6:bigalke-jung:{}", line);
- }
+ // TODO: add counter
+ // if forbidden::theorem3_2(&g) {
+ // println!("g6:t3_2:{}", line);
+ // }
- if theorem25(&g, toughness, min_degree) {
- counters.t25_hamiltonian += 1;
- println!("g6:bauer:{}", line);
- }
+ // TODO: add counter
+ // if forbidden::corollary3_5(&g) {
+ // println!("g6:c3_5:{}", line);
+ // }
+
+ // if forbidden::theorem85(&g) {
+ // println!("g6:t85:{}", line);
+ // }
+ // if forbidden::theorem86(&g) {
+ // println!("g6:t86:{}", line);
+ // }
+ // if forbidden::theorem87(&g) {
+ // println!("g6:t87:{}", line);
+ // }
+ // if forbidden::theorem88(&g) {
+ // println!("g6:t88:{}", line);
+ // }
+ // if forbidden::theorem96(&g) {
+ // println!("g6:t96:{}", line);
+ // }
+ // if forbidden::conjecture17(&g) {
+ // println!("g6:conj17:{}", line);
+ // }
+
+ // if theorem15(&g, toughness, min_degree) {
+ // counters.t15_hamiltonian += 1;
+ // println!("g6:bigalke-jung:{}", line);
+ // }
+
+ // if theorem25(&g, toughness, min_degree) {
+ // counters.t25_hamiltonian += 1;
+ // println!("g6:bauer:{}", line);
+ // }
if dirac_theorem(&g) {
counters.dirac_hamiltonian += 1;
println!("g6:dirac:{}", line);
}
- if ore_theorem(&g) {
- counters.ore_hamiltonian += 1;
- println!("g6:ore:{}", line);
- }
-
- if posa_theorem(&g) {
- counters.posa_hamiltonian += 1;
- println!("g6:posa:{}", line);
- }
-
- if is_complete {
- counters.bch_hamiltonian += 1;
- println!("g6:bondy-chvatal:{}", line);
- }
-
- if is_complete && false {
- println!("Graph: {line}\n{g}");
-
- let components_count = g.count_components();
- println!("Components count: {components_count}");
- let min_degree = g.min_degree();
- println!("Minimal degree: {min_degree}");
-
- let cutset = g.max_independent_cutset();
- println!("Maximal independent cutset:\n{}", cutset.graph);
- println!("Included vertices: {:?}", cutset.vertices);
- println!("Cutset cardinality: {}", cutset.cardinality);
-
- let cycle = bondy_chvatal_hamiltonian_cycle(&g);
- print!("Hamiltonian cycle: ");
- let start = 0;
- let mut current = start;
- loop {
- print!("{}", current + 1);
- print!(" -> ");
- current = cycle[current];
- if current == start {
- println!("{}", current + 1);
- break;
- }
- }
- }
+ // if ore_theorem(&g) {
+ // counters.ore_hamiltonian += 1;
+ // println!("g6:ore:{}", line);
+ // }
+
+ // if posa_theorem(&g) {
+ // counters.posa_hamiltonian += 1;
+ // println!("g6:posa:{}", line);
+ // }
+
+ // if is_complete {
+ // counters.bch_hamiltonian += 1;
+ // println!("g6:bondy-chvatal:{}", line);
+ // }
+
+ // if is_complete && false {
+ // println!("Graph: {line}\n{g}");
+
+ // let components_count = g.count_components();
+ // println!("Components count: {components_count}");
+ // let min_degree = g.min_degree();
+ // println!("Minimal degree: {min_degree}");
+
+ // let cutset = g.max_independent_cutset();
+ // println!("Maximal independent cutset:\n{}", cutset.graph);
+ // println!("Included vertices: {:?}", cutset.vertices);
+ // println!("Cutset cardinality: {}", cutset.cardinality);
+
+ // let cycle = bondy_chvatal_hamiltonian_cycle(&g);
+ // print!("Hamiltonian cycle: ");
+ // let start = 0;
+ // let mut current = start;
+ // loop {
+ // print!("{}", current + 1);
+ // print!(" -> ");
+ // current = cycle[current];
+ // if current == start {
+ // println!("{}", current + 1);
+ // break;
+ // }
+ // }
+ // }
let elapsed = start.elapsed();
time += elapsed.as_nanos();