Backtracking method to realize traveling salesman problem