def hidden_nodes(DAG):
    """Return a set of the hidden nodes in DAG."""
    #return {u for u,v,d in DAG.edges(data=True) if (d.get('hidden') == True} 
    # HACK: requires hidden nodes named 'U'
    return {node for node in DAG.nodes() if 'U' in node}