def dirty(graph):
    """
    Return a set of all dirty nodes in the graph.
    """
    # Reverse the edges to get true dependency
    return {n: v for n, v in graph.node.items() if v.get('build') or v.get('test')}