Struct HyperCube

Source
pub struct HyperCube(/* private fields */);

Implementations§

Source§

impl HyperCube

Source

pub fn new(n: Dims) -> Self

Examples found in repository?
examples/hyper_cube_examples.rs (line 21)
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}

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F> NPathsToNode for F

Source§

fn n_paths_to_node(&self, n: u64, d: u64) -> Vec<GraphPath<'_>>

Source§

impl<F> NodeToNodeDisjointPaths for F

Source§

impl<F> NodeToSetDisjointPaths for F

Source§

impl<F> SinglePath for F

Source§

fn single_path(&self, s: u64, d: u64) -> GraphPath<'_>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.