code: def hamiltonian(edges, directed=False, constraint_generation=True):
      
      edges = populate_edge_weights(edges)
      incident, nodes = node_to_edge(edges, directed=False)
      if not directed:  # Make graph symmetric
          dual_edges = edges[:]
          for a, b, w in edges:
              dual_edges.append((b, a, w))
          edges = dual_edges
  
      DUMMY = "DUMMY"
      dummy_edges = edges + [(DUMMY, x, 0) for x in nodes] + \
                            [(x, DUMMY, 0) for x in nodes]
  
      #results = tsp(dummy_edges, constraint_generation=constraint_generation)
      results = tsp_gurobi(dummy_edges)
      if results:
          results = [x for x in results if DUMMY not in x]
          results = edges_to_path(results)
          if not directed:
              results = min(results, results[::-1])
      return results
docs: Calculates shortest path that traverses each node exactly once. Convert
      Hamiltonian path problem to TSP by adding one dummy point that has a distance
      of zero to all your other points. Solve the TSP and get rid of the dummy
      point - what remains is the Hamiltonian Path.
  
      >>> g = [(1,2), (2,3), (3,4), (4,2), (3,5)]
      >>> hamiltonian(g)
      [1, 2, 4, 3, 5]
      >>> g = [(1,2), (2,3), (1,4), (2,5), (3,6)]
      >>> hamiltonian(g)