def breaking_cycles_by_hierarchy_performance(graph_file, gt_file, players_score_name, nodetype=int): from measures import report_performance if players_score_name != "ensembling": players_score_dict = computing_hierarchy(graph_file, players_score_name, nodetype=nodetype) e1, e2, e3, e4 = remove_cycle_edges_by_hierarchy(graph_file, players_score_dict, players_score_name, nodetype=nodetype) if players_score_name == "pagerank": report_performance(gt_file, e1, "PR") return if players_score_name == "socialagony": note = "SA_" elif players_score_name == "trueskill": note = "TS_" report_performance(gt_file, e1, note + "G") report_performance(gt_file, e2, note + "F") report_performance(gt_file, e3, note + "B") report_performance(gt_file, e4, note + "Voting") else: players_score_dict = computing_hierarchy(graph_file, "socialagony", nodetype=nodetype) e1, e2, e3, e4 = remove_cycle_edges_by_hierarchy(graph_file, players_score_dict, "socialagony", nodetype=nodetype) report_performance(gt_file, e1, "SA_G") write_pairs_to_file( e1, graph_file[:len(graph_file) - 6] + "_removed_by_SA-G.edges") report_performance(gt_file, e2, "SA_F") write_pairs_to_file( e2, graph_file[:len(graph_file) - 6] + "_removed_by_SA-F.edges") report_performance(gt_file, e3, "SA_B") write_pairs_to_file( e3, graph_file[:len(graph_file) - 6] + "_removed_by_SA-B.edges") report_performance(gt_file, e4, "SA_Voting") write_pairs_to_file( e4, graph_file[:len(graph_file) - 6] + "_removed_by_SA-Voting.edges") players_score_dict = computing_hierarchy(graph_file, "trueskill", nodetype=nodetype) e5, e6, e7, e8 = remove_cycle_edges_by_hierarchy(graph_file, players_score_dict, "trueskill", nodetype=nodetype) report_performance(gt_file, e5, "TS_G") write_pairs_to_file( e5, graph_file[:len(graph_file) - 6] + "_removed_by_TS-G.edges") report_performance(gt_file, e6, "TS_F") write_pairs_to_file( e6, graph_file[:len(graph_file) - 6] + "_removed_by_TS-F.edges") report_performance(gt_file, e7, "TS_B") write_pairs_to_file( e7, graph_file[:len(graph_file) - 6] + "_removed_by_TS-B.edges") report_performance(gt_file, e8, "TS_Voting") write_pairs_to_file( e7, graph_file[:len(graph_file) - 6] + "_removed_by_TS-Voting.edges") e9 = remove_cycle_edges_by_voting( graph_file, [set(e1), set(e2), set(e3), set(e5), set(e6), set(e7)], nodetype=nodetype) report_performance(gt_file, e9, "H_Voting") write_pairs_to_file( e9, graph_file[:len(graph_file) - 6] + "_removed_by_H-Voting.edges")
def mfas_performance(graph_file, gt_edges_file): edges_to_be_removed = remove_cycle_edges_by_mfas(graph_file) from measures import report_performance report_performance(gt_edges_file, edges_to_be_removed, "MFAS")
def dfs_performance(graph_file, gt_edges_file): edges_to_be_removed = dfs_remove_back_edges(graph_file) from measures import report_performance report_performance(gt_edges_file, edges_to_be_removed, "DFS")