hyper_cube_examples/
hyper_cube_examples.rs

1use gt_hypercube::graph::{
2    NPathsToNode, NodeToNodeDisjointPaths, NodeToSetDisjointPaths, SinglePath,
3};
4use gt_hypercube::HyperCube;
5
6fn main() {
7    example_lemma1();
8    println!("#####################");
9    example_lemma2();
10    println!("#####################");
11    example_node_to_set();
12    println!("#####################");
13    example_node_to_node();
14}
15
16fn example_lemma1() {
17    println!("this is an example of lemma1 on a HyperCube.");
18    let n = 8;
19    let s = 0b0000_0001;
20
21    let graph = HyperCube::new(n);
22
23    let path = graph.n_paths_to_node(n, s);
24
25    println!("{:#?}", path);
26}
27
28fn example_lemma2() {
29    println!("this is an example of lemma2 on a HyperCube");
30    let n = 8;
31    let s = 0b0011_0011;
32    let d = 0b1010_1010;
33
34    let graph = HyperCube::new(n);
35
36    let path = graph.single_path(s, d);
37
38    println!("{:?}", path);
39}
40
41fn example_node_to_set() {
42    println!("This is an example of node to set on a HyperCube");
43    let n = 8;
44    let s = 0b0101_0101;
45    let mut d = vec![];
46
47    for i in 0..8 {
48        d.push(1 << i);
49    }
50
51    let graph = HyperCube::new(n);
52
53    let paths = graph.node_to_set_disjoint_paths(s, &d);
54
55    println!("{:#?}", paths);
56}
57
58fn example_node_to_node() {
59    println!("This is an example of node to node on a HyperCube");
60    let n = 8;
61    let s = 0b0101_0101;
62    let d = 0b0000_1111;
63
64    let graph = HyperCube::new(n);
65
66    let paths = graph.node_to_node_disjoint_paths(s, d);
67
68    println!("{:#?}", paths);
69}