1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use crate::{Dims, DirectedBijectiveConnectionGraphFunctions, Node}; pub struct LocallyTwistedCube(Dims); impl LocallyTwistedCube { pub fn new(n: Dims) -> Self { Self(n) } } impl DirectedBijectiveConnectionGraphFunctions for LocallyTwistedCube { fn phi(&self, n: Dims, node: Node) -> Node { if n < 3 { node ^ (1 << (n - 1)) } else { node ^ ((0b10 | (node & 1)) << (n - 2)) } } fn dimension(&self) -> u64 { self.0 } }