private void printTour(Map<Index, Integer> parent, int totalVertices) {
        Set<Integer> set = new HashSet<>();
        for(int i=0; i < totalVertices; i++) {
            set.add(i);
        }
        Integer start = 0;
        Deque<Integer> stack = new LinkedList<>();
        while(true) {
            stack.push(start);
            set.remove(start);
            start = parent.get(Index.createIndex(start, set));
            if(start == null) {
                break;
            }
        }
        StringJoiner joiner = new StringJoiner("->");
        stack.forEach(v -> joiner.add(String.valueOf(v)));
        System.out.println("\nTSP tour");
        System.out.println(joiner.toString());
    }
Date 11/17/2015
@author Tushar Roy

Help Karp method of finding tour of traveling salesman.

Time complexity - O(2^n * n^2)
Space complexity - O(2^n)

https://en.wikipedia.org/wiki/Held%E2%80%93Karp_algorithm
src/com/interview/graph/TravelingSalesmanHeldKarp.java