Backtrack: generate permutations and generate graph s-t path