gt_hypercube/hypercube.rs
1use gt_directed_bijective_connection_graph::DirectedBijectiveConnectionGraph;
2use gt_graph::{Dims, Graph, Node};
3
4pub struct HyperCube(Dims);
5impl Graph for HyperCube {
6 fn dimension(&self) -> u64 {
7 self.0
8 }
9
10 #[inline(always)]
11 fn phi(&self, n: Dims, node: Node) -> Node {
12 node ^ (1 << (n - 1))
13 }
14}
15
16impl DirectedBijectiveConnectionGraph for HyperCube {}
17
18impl HyperCube {
19 pub fn new(n: Dims) -> Self {
20 Self(n)
21 }
22}