def effective_diameter_over_time():
    effective_diameters = {}
    slices = graphgen.generate_weighted_time_slices()

    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"))
Esempio n. 2
0
def effective_diameter_over_time():
    effective_diameters = {}
    slices = graphgen.generate_weighted_time_slices()

    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 frac_nodes_in_gcc_over_time():
    frac_nodes_in_gcc = {}
    graph = nx.MultiDiGraph()
    slices = graphgen.generate_weighted_time_slices()

    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"))
Esempio n. 4
0
def frac_nodes_in_gcc_over_time():
    frac_nodes_in_gcc = {}
    graph = nx.MultiDiGraph()
    slices = graphgen.generate_weighted_time_slices()

    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 = []
    slices = graphgen.generate_weighted_time_slices()

    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"))
Esempio n. 6
0
def nodes_vs_edges_over_time():
    num_nodes = []
    num_edges = []
    slices = graphgen.generate_weighted_time_slices()

    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"))
def avg_out_degree_over_time():
    slices = graphgen.generate_weighted_time_slices()

    avg_out_degrees_r = {}
    avg_out_dgree_p = {}
    for start, end in slices:
        n, m = _node_and_edges(start, end)
        if n == 0:
            continue
        rg = nx.gnm_random_graph(n, m, directed=True)
        pfg = nx.barabasi_albert_graph(n, m/n)
  
        avg_out_deg = graphtools.get_avg_out_degree_from_graph(rg)
        avg_out_degrees_r[start] = avg_out_deg
        avg_out_deg = graphtools.get_avg_out_degree_from_graph(pfg)
        avg_out_degrees_p[start] = avg_out_deg
        
    utils.save_node_map(avg_out_degrees_r, ("avg_out_degrees_r"))
    utils.save_node_map(avg_out_degrees_p, ("avg_out_degrees_p"))
Esempio n. 8
0
def avg_out_degree_over_time():
    slices = graphgen.generate_weighted_time_slices()

    avg_out_degrees_r = {}
    avg_out_dgree_p = {}
    for start, end in slices:
        n, m = _node_and_edges(start, end)
        if n == 0:
            continue
        rg = nx.gnm_random_graph(n, m, directed=True)
        pfg = nx.barabasi_albert_graph(n, m / n)

        avg_out_deg = graphtools.get_avg_out_degree_from_graph(rg)
        avg_out_degrees_r[start] = avg_out_deg
        avg_out_deg = graphtools.get_avg_out_degree_from_graph(pfg)
        avg_out_degrees_p[start] = avg_out_deg

    utils.save_node_map(avg_out_degrees_r, ("avg_out_degrees_r"))
    utils.save_node_map(avg_out_degrees_p, ("avg_out_degrees_p"))
def all_computations():
    slices = graphgen.generate_weighted_time_slices()

    avg_out_degrees_r = {}
    # effective_diameters_p = {}
    # effective_diameters_r = {}
    frac_nodes_in_gcc_p = {}
    frac_nodes_in_gcc_r = {}

    i = 0
    for start, end in slices:
        print 'slice %s of %s' % (i, len(slices))
        n, m = _node_and_edges(start, end)
        if n == 0:
            continue
        rg = nx.gnm_random_graph(n, m, directed=True)
        pfg = nx.barabasi_albert_graph(n, m/n)
  
        avg_out_deg = graphtools.get_avg_out_degree_from_graph(rg)
        avg_out_degrees_r[start] = avg_out_deg
        # effective_diam = graphtools.effective_diameter(rg)
        # effective_diameters_r[start] = effective_diam
        # effective_diam = graphtools.effective_diameter(pfg)
        # effective_diameters_p[start] = effective_diam

        frac_nodes = graphtools.get_frac_nodes_in_gcc_from_graph(rg)
        frac_nodes_in_gcc_r[start] = frac_nodes
        frac_nodes = graphtools.get_frac_nodes_in_gcc_from_graph(pfg)
        frac_nodes_in_gcc_p[start] = frac_nodes

        
    utils.save_node_map(avg_out_degrees_r, ("avg_out_degrees_r"))
    # utils.save_node_map(effective_diameters_r, ("effective_diameters_r"))
    # utils.save_node_map(effective_diameters_p, ("effective_diameters_p"))

    utils.save_node_map(frac_nodes_in_gcc_r, ("frac_nodes_in_gcc_r"))
    utils.save_node_map(frac_nodes_in_gcc_p, ("frac_nodes_in_gcc_p"))
Esempio n. 10
0
def all_computations():
    slices = graphgen.generate_weighted_time_slices()
    avg_out_degrees = {}
    frac_nodes_in_gcc = {}
    num_nodes = []
    num_edges = []
    for i in range(len(slices)):
        print i, " slices out of ", len(slices)
        start, end = slices[i]
        g = cv_from_btc(start, end)
        if len(g) == 0:
            continue
        num_nodes.append(g.number_of_nodes())
        num_edges.append(g.number_of_edges())
        avg_out_deg = graphtools.get_avg_out_degree_from_graph(g)
        avg_out_degrees[start] = avg_out_deg

        frac_nodes = graphtools.get_frac_nodes_in_gcc_from_graph(g)
        frac_nodes_in_gcc[start] = frac_nodes

    utils.save_node_map(avg_out_degrees, ("avg_out_degrees_model"))

    utils.save_node_map(frac_nodes_in_gcc, ("frac_nodes_in_gcc_model"))
    utils.save_lists(num_nodes, num_edges, ("nodes_vs_edges_model"))
def all_computations():
    slices = graphgen.generate_weighted_time_slices()
    avg_out_degrees = {}
    frac_nodes_in_gcc = {}
    num_nodes = []
    num_edges = []
    for i in range(len(slices)):
        print i, " slices out of ", len(slices)
        start, end = slices[i]
        g = cv_from_btc(start, end)
        if len(g) == 0:
            continue
        num_nodes.append(g.number_of_nodes())
        num_edges.append(g.number_of_edges())
        avg_out_deg = graphtools.get_avg_out_degree_from_graph(g)
        avg_out_degrees[start] = avg_out_deg

        frac_nodes = graphtools.get_frac_nodes_in_gcc_from_graph(g)
        frac_nodes_in_gcc[start] = frac_nodes

    utils.save_node_map(avg_out_degrees, ("avg_out_degrees_model"))

    utils.save_node_map(frac_nodes_in_gcc, ("frac_nodes_in_gcc_model"))
    utils.save_lists(num_nodes, num_edges, ("nodes_vs_edges_model"))
Esempio n. 12
0
def all_computations():
    slices = graphgen.generate_weighted_time_slices()

    avg_out_degrees_r = {}
    # effective_diameters_p = {}
    # effective_diameters_r = {}
    frac_nodes_in_gcc_p = {}
    frac_nodes_in_gcc_r = {}

    i = 0
    for start, end in slices:
        print 'slice %s of %s' % (i, len(slices))
        n, m = _node_and_edges(start, end)
        if n == 0:
            continue
        rg = nx.gnm_random_graph(n, m, directed=True)
        pfg = nx.barabasi_albert_graph(n, m / n)

        avg_out_deg = graphtools.get_avg_out_degree_from_graph(rg)
        avg_out_degrees_r[start] = avg_out_deg
        # effective_diam = graphtools.effective_diameter(rg)
        # effective_diameters_r[start] = effective_diam
        # effective_diam = graphtools.effective_diameter(pfg)
        # effective_diameters_p[start] = effective_diam

        frac_nodes = graphtools.get_frac_nodes_in_gcc_from_graph(rg)
        frac_nodes_in_gcc_r[start] = frac_nodes
        frac_nodes = graphtools.get_frac_nodes_in_gcc_from_graph(pfg)
        frac_nodes_in_gcc_p[start] = frac_nodes

    utils.save_node_map(avg_out_degrees_r, ("avg_out_degrees_r"))
    # utils.save_node_map(effective_diameters_r, ("effective_diameters_r"))
    # utils.save_node_map(effective_diameters_p, ("effective_diameters_p"))

    utils.save_node_map(frac_nodes_in_gcc_r, ("frac_nodes_in_gcc_r"))
    utils.save_node_map(frac_nodes_in_gcc_p, ("frac_nodes_in_gcc_p"))
Esempio n. 13
0
  
  print 'finished %s tag over time' % i
  i += 1

# utils.save_lists(dates, deg_connectivity, stamp='gnp_deg_conn')
utils.save_lists(dates, avg_clust, stamp='gnp_avg_clust')
utils.save_lists(dates, lccs, stamp='gnp_lccs')
utils.save_lists(dates, largest_scc, stamp='gnp_largest_scc')

utils.save_lists(dates, avg_clust_p, stamp='pfg_avg_clust')
utils.save_lists(dates, lccs_p, stamp='pfg_lccs')
# plot single values over time
# Gini coefficient (way to get single number from distribution)
'''
_HMS = graphgen._HMS
slices = graphgen.generate_weighted_time_slices()
i = 0
dates = []
avg_clust = []
lccs = []
largest_scc = []

for start, end in slices:
    g = cv_from_btc(start * _HMS, end * _HMS)
    if len(g) == 0:
        continue
    stamp = str(start) + '_' + str(end)
    
    tags_over_time.user_transaction_frequency(g, 'model_' + stamp)
    tags_over_time.user_buy_frequency(g, 'model_' + stamp)
    tags_over_time.user_sell_frequency(g, 'model_' + stamp)