Uniquely identify hypercube faces I have a problem where I want to easily map a set to the faces of a n-dimensional hypercube.
For sake of example.
For a 1d hypercube we have a line segment $[A,B]$ where the faces are the points $A$ and $B$. That we loosely call: left and right.
For a 2d hypercube we have a  square with the points $[A,B,C,D]$ where $\overline{AB}$, $\overline{AC}$, $\overline{CD}$, $\overline{BD}$. That we call left, right, up, down.
For a 3d hypercube we have the cube with points $[A,B,C,D,E,F,G,H]$ where the faces are $\overline{ABCD}$, $\overline{EFGH}$, $\overline{ABEF}$, $\overline{CDGH}$, $\overline{BCFG}$, $\overline{ADEH}$, that we call: up, down, left, right, front and back.
And goes on, the 4D isn't so simple to describe, since lacks me the construtive view.
My questions are:


*

*How to generalize the construction of the faces for any n-dimensional hypercube.

*How to create a map? I initially thought in a vector map for example:
1d case: $[A,B] \to [1,0]$ or $[0,1]$ (for left and right).
2d case: $[A,B,C,D] \to \left\{ [1,1,0,0], [1,0,1,0],[0,0,1,1], [0,1,0,1] \right\}$
3d case: $[A,B,C,D,E,F,G] \to \left\{ [1,1,1,1,0,0,0,0], [0,0,0,0,1,1,1,1], [1,1,0,0,1,1,0,0], [0,0,1,1,0,0,1,1], [0,1,1,0,0,1,1,0], [1,0,0,1,1,0,0,1]  \right\}$
Of course it depends in orientation of the face creation and point distribution. We have to avoid the diagonal for example in $2d$ case $[0,1,1,0], [1,0,0,1]$ should not be valid since is the diagonal line (if we take the same square defined above). My 2d square is like:
A o-------o B
  |       |
  |       |
C o-------o D

My second issue is that the map leads to a very sparse structures for example the 3D cases we have only 6 valid combinations (not taking in account the simetrics) where the set has $2^8=64$ patterns.
Of course I can map the sets $U \to V \to W $ as:
$ U \equiv \mathbb{N} $
$ V \equiv $ valid face bits
$ W \equiv $ cube faces
In 3D case:
$ U = \left\{ 0,1,2,3,4,5 \right\} $
$ V = \left\{ [1,1,1,1,0,0,0,0] , [0,0,0,0,1,1,1,1], [1,1,0,0,1,1,0,0]\\, [0,0,1,1,0,0,1,1], [0,1,1,0,0,1,1,0], [1,0,0,1,1,0,0,1]  \right\}$
$ W = \overline{ABCD}, \overline{EFGH}, \overline{ABEF}, \overline{CDGH}, \overline{BCFG}, \overline{ADEH}$
The reason that I'm doing this is because I want to apply filters on borders of  a N-dimensional mesh and I want to be able to know which faces I want to apply.
Any ideas are welcome?
 A: Looks like a Rubik's cube encoding.
There are $2n$ facets in an hypercube, which you can arrange in two sets of facets:
$$F_{i,0}=\{(x_1,\dots,x_n)\in [0,1]^n\}\cap \{x_i=0\}$$
and
$$F_{i,1}=\{(x_1,\dots,x_n)\in [0,1]^n\}\cap \{x_i=1\}.$$
Each facet has $2^{n-1}$ vertices:
$$V(F_{i,0})=\{(x_1,\dots,x_n)\in \{0,1\}^n\}\cap \{x_i=0\}.$$
$$V(F_{i,1})=\{(x_1,\dots,x_n)\in \{0,1\}^n\}\cap \{x_i=1\}.$$
and you could encode them in binary. I.e., for a fixed facet $F_{i,\ast}$ you can write them as a binary number in $[0,2^{n-1}]$. For instance, the seventh vertice ("111") of $F_{5,1}$ in $\mathbb R^9$ is $(0,0,0,0,1,0,1,1,1)$. This gives you an optimized representation. 
A: Assume for simplicity that all $2^d$ vertices of the $d$-dimensional dimensional cube are binary $d$-tuples. Then any face of the cube can be encoded by a pair of numbers $(n,r)$ where $n$ is the position in the $d$-tuple and $r$ is either 0 or 1. Accordingly there are altogether $2d$ faces, each face being a $(d-1)$-dimensional cube.
For example a face of 8-dimensional cube encoded $(5,0)$ has the vertices:
$$
(r_1,r_2,r_3,r_4,0,r_6,r_7,r_8),
$$
where $r_i$ run over $(0,1)$.
The opposite face encoded $(5,1)$ has corresponding vertices at:
$$(r_1,r_2,r_3,r_4,1,r_6,r_7,r_8).
$$ 
