def edges_to_adj_list(edges):
    """
    Transforms a set of edges in an adjacency list (represented as a dictiornary)

    For UNDIRECTED graphs, i.e. if v2 in adj_list[v1], then v1 in adj_list[v2]

    INPUT:
        - edges : a set or list of edges

    OUTPUT:
        - adj_list: a dictionary with the vertices as keys, each with
                a set of adjacent vertices.
    """
    adj_list = {}  # store in dictionary
    for v1, v2 in edges:
        if v1 in adj_list:  # edge already in it
            adj_list[v1].add(v2)
        else:
            adj_list[v1] = set([v2])
        if v2 in adj_list:  # edge already in it
            adj_list[v2].add(v1)
        else:
            adj_list[v2] = set([v1])
    return adj_list