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
Perform the tree reduction step of a reduction.
dataset/ETHPy150Open tanghaibao/jcvi/algorithms/lpsolve.py/hamiltonian--crossover with--dataset/ETHPy150Open dask/dask/dask/array/reductions.py/_tree_reduce