1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
use crate::{Dims, DirectedBijectiveConnectionGraphFunctions, Node};

pub struct HyperCube(Dims);
impl DirectedBijectiveConnectionGraphFunctions for HyperCube {
    #[inline(always)]
    fn phi(&self, n: Dims, node: Node) -> Node {
        node ^ (1 << (n - 1))
    }

    fn dimension(&self) -> u64 {
        self.0
    }
}

impl HyperCube {
    pub fn new(n: Dims) -> Self {
        Self(n)
    }
}