def map_int_to_tour(num_nodes, i, start_node):
 nodes_remaining = (range(0, start_node) + range((start_node + 1), num_nodes))
 tour = []
 while (len(nodes_remaining) > 0):
  num_nodes = len(nodes_remaining)
  next_step = nodes_remaining[(i % num_nodes)]
  nodes_remaining.remove(next_step)
  tour.append(next_step)
  i = (i / num_nodes)
 tour = (([start_node] + tour) + [start_node])
 return tour

def map_int_to_tour ( num_nodes , i , start_node ) : nodes_remaining = ( range ( 0 , start_node ) + range ( ( start_node + 1 ) , num_nodes ) ) tour = [ ] while ( len ( nodes_remaining ) > 0 ) : num_nodes = len ( nodes_remaining ) next_step = nodes_remaining [ ( i % num_nodes ) ] nodes_remaining . remove ( next_step ) tour . append ( next_step ) i = ( i / num_nodes ) tour = ( ( [ start_node ] + tour ) + [ start_node ] ) return tour
gets a unique tour through a graph given an integer and starting node .