def effective_diameter_over_time(): effective_diameters = {} graph = nx.MultiDiGraph() for end_day in graphgen._days: start = int(str(end_day) + "000000") end = int(str(end_day) + "235959") graph = graphgen.add_slice_to_graph(graph, start, end) effective_diam = graphtools.effective_diameter(graph) effective_diameters[end_day] = effective_diam print end_day, effective_diam utils.save_node_map(effective_diameters, ("effective_diameters"))
def avg_out_degree_over_time(): avg_out_degrees = {} graph = nx.MultiDiGraph() for end_day in graphgen._days: start = int(str(end_day) + "000000") end = int(str(end_day) + "235959") graph = graphgen.add_slice_to_graph(graph, start, end) avg_out_deg = graphtools.get_avg_out_degree_from_graph(graph) avg_out_degrees[end_day] = avg_out_deg print end_day, avg_out_deg utils.save_node_map(avg_out_degrees, ("avg_out_degrees"))
def frac_nodes_in_gcc_over_time(): frac_nodes_in_gcc = {} graph = nx.MultiDiGraph() for end_day in graphgen._days: start = int(str(end_day) + "000000") end = int(str(end_day) + "235959") graph = graphgen.add_slice_to_graph(graph, start, end) frac_nodes = graphtools.get_frac_nodes_in_gcc_from_graph(graph) frac_nodes_in_gcc[end_day] = frac_nodes print end_day, frac_nodes utils.save_node_map(frac_nodes_in_gcc, ("frac_nodes_in_gcc"))
def nodes_vs_edges_over_time(): num_nodes = [] num_edges = [] graph = nx.MultiDiGraph() for end_day in graphgen._days: start = int(str(end_day) + "000000") end = int(str(end_day) + "235959") graph = graphgen.add_slice_to_graph(graph, start, end) nodes, edges = graphtools.get_num_nodes_edges_from_graph(graph) num_nodes.append(nodes) num_edges.append(edges) print nodes, edges utils.save_lists(num_nodes, num_edges, ("nodes_vs_edges"))