12
1
Your job will be to write a function or a program, that will take an integer n>0 as input and output a list of the edges of the n-dimensional hypercube. In graph theory an edge is defined as a 2-tuple of vertices (or corners, if you prefer), that are connected.
Example 1
A 1-dimensional hypercube is a line and features two vertices, which we will call a and b.
Therefore, the output will be:
[[a, b]]
Example 2
The 4-dimensional hypercube (or tesseract) consists of 32 edges and its graph looks like this
and the output could look like this
[[a, b], [a, c], [a, e], [a, i], [b, d], [b, f], [b, j], [c, d], [c, g], [c, k], [d, h], [d, l], [e, f], [e, g], [e, m], [f, h], [f, n], [g, h], [g, o], [h, p], [i, j], [i, k], [i, m], [j, l], [j, n], [k, l], [k, o], [l, p], [m, n], [m, o], [n, p], [o, p]]
Rules
- You may name the vertices any way you like, as long as the name is unique.
- The edges are undirected, i.e.
[a, b]and[b, a]are considered the same edge. - Your output must not contain duplicate edges.
- The output may be in any sensible format.
- Standard loopholes are forbidden.
Scoring
Shortest code wins.


Related. Related. – Martin Ender – 2016-03-16T22:28:01.270
So [1,2], [2,3] etc. is okay? – Rɪᴋᴇʀ – 2016-03-16T22:36:07.500
@EasterlyIrk Yep. – murphy – 2016-03-16T22:38:06.950
Edges can be output in any order, right? – Luis Mendo – 2016-03-16T22:56:22.670
@DonMuesli Right. – murphy – 2016-03-16T23:01:29.457