Given an adjacency matrix, how would you find the shortest paths between two nodes while traversing to each point at least once and returning how many moves it takes?
Example
Given this array
int[][] points = { { 0, 1 },{ 0, 2 },{ 1, 2 },{ 1, 3 },{ 3, 4 } };
I make an adjacent matrix like so...
0 1 2 3 4
0 [0] [1] [1] [0] [0]
1 [1] [0] [1] [1] [0]
2 [1] [1] [0] [0] [0]
3 [0] [1] [0] [0] [1]
4 [0] [0] [0] [1] [0]
The shortest path from 0 - 4 is (0-2)(2-1)(1-3)(3-4) and counts to be 4 moves.
I really have no idea how to go any further. Possibly a minimum spanning tree solution? Thanks in advance.