self._node_numbers.extend(list(new_node_neighbors))

        #update the number of nodes
        self._num_nodes += 1
        return new_node_neighbors


def make_dpa_graph(n, m):

    dpa_graph = module_1.make_complete_graph(m)
    dpa = DPATrial(m)

    for new_node in range(m, n):
        new_node_neighbors = dpa.run_trial(m)
        dpa_graph[new_node] = new_node_neighbors

    return dpa_graph


if __name__ == '__main__':


    graph = project_1.normalize_distribution(module_1.in_degree_distribution(make_dpa_graph(27770,12)))
    plt.loglog(graph.keys(), graph.values(), 'go')
    plt.xlabel('Papers')
    plt.ylabel('Cications')
    plt.title('DPA Citation graph simulation')
    plt.show()


                    edges.add(edge)
        graph[node] = edges

    return graph

def normalize_distribution(distribution):

    factor = 1.0/sum(distribution.values())
    normalized_distribution = {key: val*factor for key, val in distribution.items()}

    return normalized_distribution

if __name__ == '__main__':

    citation_graph = load_graph(CITATION_URL)
    citation_distribution = normalize_distribution(in_degree_distribution(citation_graph))

    plt.loglog(citation_distribution.keys(),citation_distribution.values(),'go')
    plt.title('Citation Graph')
    plt.xlabel('papers')
    plt.ylabel('citations')
    plt.show()

    graph1 = normalize_distribution(in_degree_distribution(compleate_directed_graph(300, 0.6)))
    graph2 = normalize_distribution(in_degree_distribution(compleate_directed_graph(500, 0.2)))
    graph3 = normalize_distribution(in_degree_distribution(compleate_directed_graph(800, 0.8)))

    for graph in (graph1, graph2, graph3):

        plt.loglog(graph.keys(), graph.values(), 'go')
        plt.title('ER graph in-degree distribution')