Code:

// http://www.mathhelpforum.com/math-help/pre-algebra-algebra/140117-cubes-networks-shortest-path.html
import java.util.ArrayList;
public class CubeGraph {
private static int[][] map;
private static double min = 1000, min1, sq22 = Math.sqrt(2)/2.0;
private static ArrayList<Integer> minPath;
public static void init() {
// map each vertex to either four or six other vertices
// using hard-coded values; could also generate with method
int[] v0 = {1, 2, 4, 8, 9, 10};
int[] v1 = {0, 3, 5, 8, 9, 11};
int[] v2 = {0, 3, 6, 8, 10, 12};
int[] v3 = {1, 2, 7, 8, 11, 12};
int[] v4 = {0, 5, 6, 9, 10, 13};
int[] v5 = {1, 4, 7, 9, 11, 13};
int[] v6 = {2, 4, 7, 10, 12, 13};
int[] v7 = {3, 5, 6, 11, 12, 13};
int[] v8 = {0, 1, 2, 3};
int[] v9 = {0, 1, 4, 5};
int[] v10 = {0, 2, 4, 6};
int[] v11 = {1, 3, 5, 7};
int[] v12 = {2, 3, 6, 7};
int[] v13 = {4, 5, 6, 7};
int[][] map1 = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13};
map = deepCopy(map1);
}
public static void main(String[] args) {
long time = System.currentTimeMillis();
init();
ArrayList<Integer> path = new ArrayList<Integer>();
boolean[] visited = new boolean[14];
backtrack(path, visited, 0, 0);
min1 = min;
System.out.println("Starting on corner: min dist = " + min + " and path = " + minPath);
min = 1000;
path = new ArrayList<Integer>();
visited = new boolean[14];
backtrack(path, visited, 8, 0);
System.out.println("Starting on center: min dist = " + min + " and path = " + minPath);
System.out.println("in " + ((System.currentTimeMillis() - time) / 1000.0) + " s");
}
public static void backtrack(ArrayList<Integer> path, boolean[] visited, int vertex, double dist) {
if (dist > min) return;
visited[vertex] = true;
path.add(vertex);
if (path.size() == 14) {
if (dist < min) {
min = dist;
minPath = new ArrayList<Integer>();
minPath.addAll(path);
}
return;
}
for (int i = 0; i < map[vertex].length; i++) {
int nextV = map[vertex][i];
if (!visited[nextV])
backtrack(new ArrayList<Integer>(path), visited.clone(), nextV, dist + getDist(vertex, nextV));
}
}
public static double getDist(int v1, int v2) {
return (v1 > 7 || v2 > 7) ? sq22 : 1;
}
public static int[][] deepCopy(int[][] orig) {
int[][] copy = new int[orig.length][];
for (int i = 0; i < orig.length; i++)
copy[i] = orig[i].clone();
return copy;
}
}

Output: Code:

Starting on corner: min dist = 9.485281374238573 and path = [0, 1, 8, 2, 10, 4, 9, 5, 11, 3, 12, 6, 13, 7]
Starting on center: min dist = 9.778174593052025 and path = [8, 0, 1, 3, 11, 5, 9, 4, 10, 2, 12, 6, 13, 7]
in 0.375 s

Which is faster than I expected. I believe the code is bug-free, but confirmation is always welcome. It can be seen that the minimum path I got has a distance of