Genearalisation of previous MSE question regarding password combinatorics in $n$ dimensions

56 Views Asked by At

This question caught my atention recently. Most (if not all) of the answers aproached the problem via a brute force attack. Surely there is a more elegant way to deal with this, given the inherent symmetry.

My question is can this be generalised to an $n$ dimensional lattice? Clearly the placement of the nearest neighbour is critical in this problem (ie, it is unclear where $n=5$ in $2$ dimensions would be places in terms of the classical Descatrian coordinate system), but it could also be generalised to $n$ in any dimension. Is this a Hamiltonian path (ie NP hard problem), or can the symmetry be utilised to present a more analytic solution?

Note

If standard MSE policy of questions being self-contained is desired, please note, and I will alter.

1

There are 1 best solutions below

1
On BEST ANSWER

In general your "dots" form the vertices of a graph, and I think you're asking for the number of self-avoiding walks of a given length on this graph. There is a huge literature on self-avoiding walks. In general, counting self-avoiding walks is #P-complete, and thus very difficult: see e.g. this paper.