6
public Pair(int i, int path) {12
public int shortestPathLength(int[][] graph) {14
For each node currentNode, steps as key, visited as value15
boolean[currentNode][steps]19
// 111....1, 1<< n - 120
int allVisited = (1 << n) - 1;22
boolean[][] visited = new boolean[n][1 << n];23
Queue<Pair> q = new LinkedList<>();24
for (int i = 0; i < n; i++) {25
if (1 << i == allVisited) return 0;26
visited[i][1 << i] = true;27
q.offer(new Pair(i, 1 << i));30
while (!q.isEmpty()) {32
for (int i = 0; i < size; i++) {34
int[] edges = graph[p.i];37
int path = p.path | (1 << t);38
if (path == allVisited) return step + 1;39
if (!visited[t][path]) {40
visited[t][path] = true;41
q.offer(new Pair(t, path));