I am looking for an algorithm that can find the shortest path between a set of vertices in 5 dimensions given a single source.
For example if I have a 10 x 5 array, where each row corresponds to a point in 5 dimensional space. How do I reorder the rows such that travelling from top to bottom of the array results in the minimum total Euclidean distance travelled.
My end goal is to perform this operation in python.
I feel this must be a well defined problem but my research has not led me anywhere conclusive. It seems to me that a solution would incorporate graph theory - a minimum spanning tree. I'd be very grateful for any suggestions.
This is the Euclidean version of the Traveling salesman problem. It's an NP-hard problem, so finding the optimal solution is hard when your array is very large. (For $10$ points in five dimensions, even trying all $10!$ orders is not entirely out of the question.) Techniques based on integer programming can solve larger problems.
There are various approximation algorithms. Wikipedia mentioned a method based on a minimum spanning tree that gets within a factor of $2$ of the shortest tour. There is an improvement that gets a $\frac32$-approximation, and is still not too bad to implement (the Christofides algorithm).
For the Euclidean version in a fixed number of dimensions, there is an algorithm that can guarantee arbitrarily good approximations efficiently, but I suspect that this is too complicated to bother.