def create_graph(liveness):
    """Takes the liveness and transforms it to a graph (dict with key node, value set of edges"""
    g = {}
    for l_set in liveness:
        for item in l_set:
            s = (g[item] if item in g else set()) | l_set
            if item in s:  # remove self edge
                s.remove(item)
            g[item] = s
    return g