Exemplo n.º 1
0
    def get_loc_sim_matrix(graph, graph1):
        centra = Centrality()
        aifsim = Aifsim()

        g_copy = graph.copy()
        g1_copy = graph1.copy()

        g_lnodes = centra.get_l_node_list(g_copy)
        g1_lnodes = centra.get_l_node_list(g1_copy)
        relsl, valsl, switched = aifsim.text_sim_matrix(g_lnodes, g1_lnodes)

        rels_dict = aifsim.rels_to_dict(relsl, switched)

        return rels_dict
Exemplo n.º 2
0
    def get_graph_sim(aif_id1, aif_id2):
        centra = Centrality()
        aifsim = Aifsim()
        graph, json = aifsim.get_graph(aif_id1, centra)
        graph1, json1 = aifsim.get_graph(aif_id2, centra)
        graph = centra.remove_iso_analyst_nodes(graph)
        graph1 = centra.remove_iso_analyst_nodes(graph1)
        rep_form = aifsim.is_iat(graph, graph1, centra)
        g_copy = graph.copy()
        g1_copy = graph1.copy()
        graph_mean = 0
        text_mean = 0
        overall_mean = 0
        if rep_form == 'diff':
            return 'Error'
        else:
            graph_mean = aifsim.call_diagram_parts_and_sum(
                g_copy, g1_copy, rep_form)
        if rep_form == 'aif':
            g_inodes = centra.get_i_node_list(g_copy)
            g1_inodes = centra.get_i_node_list(g1_copy)
            relsi, valsi, switched = aifsim.text_sim_matrix(
                g_inodes, g1_inodes)
            i_mean = aifsim.get_mean_of_list(valsi)
            text_mean = i_mean
        else:
            g_inodes = centra.get_i_node_list(g_copy)
            g1_inodes = centra.get_i_node_list(g1_copy)
            g_lnodes = centra.get_l_node_list(g_copy)
            g1_lnodes = centra.get_l_node_list(g1_copy)
            relsi, valsi, switched = aifsim.text_sim_matrix(
                g_inodes, g1_inodes)
            relsl, valsl, switched = aifsim.text_sim_matrix(
                g_lnodes, g1_lnodes)
            i_mean = aifsim.get_mean_of_list(valsi)
            l_mean = aifsim.get_mean_of_list(valsl)
            text_mean = aifsim.get_l_i_mean(l_mean, i_mean)

        overall_score = aifsim.get_l_i_mean(text_mean, graph_mean)
        return overall_score, text_mean, graph_mean
Exemplo n.º 3
0
def get_ordered_nodes(node_id, isMap):
    centra = Centrality()
    #node_path = centra.get_nodeset_path(node_id)
    #Add extension for L-nodes here
    node_path = centra.create_json_url(node_id, isMap)
    graph = centra.get_graph_url(node_path)
    graph = centra.remove_iso_nodes(graph)
    l_nodes = centra.get_l_node_list(graph)
    l_node_i_node = centra.get_loc_prop_pair(graph)
    n_graph = centra.remove_redundant_nodes(graph)
    list_of_nodes = centra.list_nodes(graph)
    divergent_nodes = centra.get_divergent_nodes(n_graph)
    s_nodes = centra.get_s_node_list(n_graph)
    i_nodes = centra.get_eigen_centrality(n_graph)
    ordered_nodes = centra.sort_by_centrality(i_nodes)
    children, edges = centra.get_child_edges(n_graph)

    return ordered_nodes, list_of_nodes, divergent_nodes, children, edges, s_nodes, l_nodes, l_node_i_node