Exemplo n.º 1
0
def perform_test2(graphs_dir1, graphs_dir2, number_from, result_file,
                  slots_count):
    while number_from < slots_count:
        for slot_file in os.listdir(graphs_dir1):
            if slot_file.endswith(".json") and slot_file.startswith(
                    "salon24_" + str(number_from) + "_"):
                logging.info(graphs_dir1 + slot_file)
                split = slot_file.split('.')
                split = split[0].split('_')
                idx = split[1]
                date_from = split[2]
                date_to = split[3]
                G = load(graphs_dir1 + slot_file)
                previous = MatchStructure(G, idx, None, date_from, date_to)
                number_from += 1
                for slot_file1 in os.listdir(graphs_dir2):
                    if slot_file1.endswith(".json") and slot_file1.startswith(
                            "salon24_" + str(number_from) + "_"):
                        logging.info(graphs_dir2 + slot_file1)
                        split1 = slot_file1.split('.')
                        split1 = split1[0].split('_')
                        idx1 = split1[1]
                        date_from1 = split1[2]
                        date_to1 = split1[3]
                        G1 = load(graphs_dir2 + slot_file1)
                        current = MatchStructure(G1, idx1, None, date_from1,
                                                 date_to1)
                        match_slots(previous, current, result_file)
Exemplo n.º 2
0
def create_ranking_graphs(graphs_dir, results_dir, slots_count,
                          number_of_vertices, measure):
    last_end_date = None
    graphs_per_month = []

    i = 1
    j = 1
    while i < slots_count:

        for slot_file in os.listdir(graphs_dir):
            if slot_file.endswith(".json") and slot_file.startswith(
                    "salon24_" + str(i) + "_"):
                split = slot_file.split('.')
                split = split[0].split('_')
                if last_end_date is None:
                    last_end_date = split[3]
                month_curr = datetime.datetime.strptime(split[3],
                                                        DATE_FORMAT).month
                month_last = datetime.datetime.strptime(
                    last_end_date, DATE_FORMAT).month
                logging.info(graphs_dir + slot_file)
                G = load(graphs_dir + slot_file)

                if month_curr != month_last:
                    get_rankings_graph(results_dir, j, graphs_per_month,
                                       last_end_date, number_of_vertices)
                    j += 1
                    graphs_per_month = [G]
                else:
                    graphs_per_month.append(G)

                last_end_date = split[3]
                i += 1
Exemplo n.º 3
0
def perform_test(graphs_dir, number_from, result_file, slots_count):
    previous = None

    while number_from <= slots_count:
        for slot_file in os.listdir(graphs_dir):
            if slot_file.endswith(".json") and slot_file.startswith("salon24_" + str(number_from) + "_"):
                logging.info(graphs_dir + slot_file)
                split = slot_file.split('.')
                split = split[0].split('_')
                idx = split[1]
                month = split[2]
                G = load(graphs_dir + slot_file)
                current = MatchStructure(G, idx, month)
                if previous is not None:
                    match_slots(previous, current, result_file)
                number_from += 1
                previous = current
Exemplo n.º 4
0
def create_ranking_graphs_weeks(graphs_dir, result_dir, slots_count,
                                number_of_vertices, measure):
    i = 1
    previous = None
    while i < slots_count:
        for slot_file in os.listdir(graphs_dir):
            if slot_file.endswith(".json") and slot_file.startswith(
                    "salon24_" + str(i) + "_"):
                split = slot_file.split('.')
                split = split[0].split('_')
                idx = split[1]
                date_from = split[2]
                date_to = split[3]
                logging.info(graphs_dir + slot_file)
                G = load(graphs_dir + slot_file)
                get_ranking_graphs_weeks(result_dir, idx, G, previous,
                                         date_from, date_to,
                                         number_of_vertices, measure)
                i += 1
                previous = G