Let's consider a grid in a multidimensional space. Each grid has 'n' number of lines, spaced one unit apart. A path (or walk) of 'm' steps is between two grid intersections. A step is a single unit movement in any dimension (direction).
I'll cut through the fluff by providing an example :
Let's say we have 2 dimensions and 3 grid lines. The grid intersections (x,y), where x,y ∈ {0,1,2}.
There will be six valid walks starting at (0,0) of length m=2:
(0,0)→(0,1)→(0,0)
(0,0)→(0,1)→(0,2)
(0,0)→(0,1)→(1,1)
(0,0)→(1,0)→(0,0)
(0,0)→(1,0)→(2,0)
(0,0)→(1,0)→(1,1)
Then generalize this for d dimensions, n gridlines, m steps and any starting point.
I'm not interested in knowing what the paths look like, just how many of them there are based on the starting location and the other parameters.
I wrote a python script (iterative and recursive) that kinda generates this (at each intersection, it generates all the possible following steps), but it chokes when the dimensions and steps start to get larger. Since we're supposed to know what's the highest count of paths possible considering all starting locations, this "brute-force" approach is definitely not the way to go I believe.
I was wondering if there was a way to solve this in a simpler manner, involving math to generate the number of final intersections to be visited based on the different parameters, without having to actually generate the paths maybe ?
The number of shortest paths from $(0,0,0)$ to $(a,b,c)$ is $$\frac{(a+b+c)!}{a!\;b!\;c!}$$ with an obvious extension to higher dimensions. This is a Multinomial Coefficient.