def all_arcs(constraints):
    """
    For each constraint ((X, Y), const) adds:
        ((X, Y), const)
        ((Y, X), const)
    """
    arcs = set()

    for neighbors, constraint in constraints:
        if len(neighbors) == 2:
            x, y = neighbors
            list(map(arcs.add, ((x, y), (y, x))))

    return arcs
def all_arcs ( constraints ) : arcs = set ( ) for neighbors , constraint in constraints : if len ( neighbors ) == 2 : x , y = neighbors list ( map ( arcs . add , ( ( x , y ) , ( y , x ) ) ) ) return arcs
For each constraint ((X, Y), const) adds:
        ((X, Y), const)
        ((Y, X), const)