def tour_valid(tour, edges):
    """checks if the given tour only uses edges in the given graph"""
    for edge in tour:
        #print(edge)
        if edge not in edges:
            return False
    return True