Need help in travelling salesman problem, brute force algorithm in matlab

Need help in travelling salesman problem, brute force algorithm in matlab
0.0 0

#1

I have written codes which generate an n x n distance matrix, but i need help to
generate all the possible paths/permutations without using the perms
function in matlab
For example this is my distance matrix:

This is my distance matrix.
A B C
A 0 29.4109 107.1681
B 29.4109 0 94.8683
C 107.1681 94.8683 0

I want to find the distance of all paths(this is for 3x3matrix)
ABC
ACB

So a 4x4matrix will be
ABCD
ABDC
ACBD
ACDB
ADBC
ADCB


#2

Don’t know what Matlab code looks like, but at least one of the languages that isn’t Matlab, Mathematica or Julia, so doesn’t have a builtin permutations function, should be translatable to Matlab: http://rosettacode.org/wiki/Permutations