TODO: move this to include_graph

def invert_graph(include_graph):
    """
    TODO: move this to include_graph 
    """

    file_index = include_graph.file_index
    dep_extractor = include_graph.dep_extractor

    inverted_graph = IncludeGraph(file_index, dep_extractor)
    inverted_graph.active = True

    for node, edges in include_graph:
        inverted_graph.add_node(node)

        for edge in edges:
            inverted_graph.add_edge(edge.to, node, edge.settings['type'])

    return inverted_graph