示例#1
0
 void EnableSearchOnMatchNeighborhood(const MatchSet* m, 
         const Subgraph& g, int sj_tree_node)
 {
     for (Subgraph::VertexIterator v_it = g.BeginVertexSet();
             v_it != g.EndVertexSet(); v_it++) {
         uint64_t query_node = *v_it;
         uint64_t data_graph_node = m->GetMatch(query_node);
         EnableSearchOnNode(data_graph_node, sj_tree_node);
     }
     return;
 }
示例#2
0
    void RetroSearch(const MatchSet* m, const Subgraph& join_subgraph, 
            int sj_tree_node)
    {
#ifdef TIMING
        struct timeval start, end;
        gettimeofday(&start, NULL);
#endif
        int next = 0;
        // cout << "               LOG Filling kv_scratchpad" << endl;
        // Extract the nodes from G_d where to extend the search.
        for (Subgraph::VertexIterator v_it = join_subgraph.BeginVertexSet();
                v_it != join_subgraph.EndVertexSet(); v_it++) {
            uint64_t query_node = *v_it;
            uint64_t data_graph_node = m->GetMatch(query_node);
            uint64_t degree = gSearch__->NeighborCount(data_graph_node);
            kv_scratchpad[next++] = 
                    pair<uint64_t, uint64_t>(degree, data_graph_node);
        }

        // assert(next > 0);
        if (next == 0) {
            return;
        }
        // cout << "               LOG sorting kv_scratchpad" << endl;
        sort(kv_scratchpad, kv_scratchpad + next);

        // cout << "               LOG Determining init_search" << endl;
        uint64_t init_search = kv_scratchpad[0].second;
        d_array<MatchSet*> match_list;
        // cout << "               LOG Executing search: " << sj_tree_node << endl;
        int leaf_index = -1;
        for (int i = 0; i < leaf_count__; i++) {
            // cout << "               LOG leaf node id: " << leaf_ids__[i] << endl;
            if (leaf_ids__[i] == sj_tree_node) {
                leaf_index = i;
                break;
            }
        }
        assert(leaf_index >= 0);
        leaf_queries__[leaf_index]->Execute(init_search, match_list);
        // cout << "               LOG Done executing search " << endl;

        for (int i = 0, N = match_list.len; i < N; i++) {
            // cout << "               LOG Transforming match results" << endl;
            TransformMatchSet(id_maps__[leaf_index], match_list[i]);
            bool match_found = true;
            for (Subgraph::VertexIterator v_it = join_subgraph.BeginVertexSet();
                    v_it != join_subgraph.EndVertexSet(); v_it++) {
                uint64_t query_node = *v_it;
                uint64_t match1 = m->GetMatch(query_node);
                uint64_t match2 = match_list[i]->GetMatch(query_node);
                if (match1 != match2) {
                    match_found = false;
                    break;
                } 
            }
            if (match_found) {
                // cout << "               LOG ProcessMatch" << endl;
                ProcessMatch(match_list[i], sj_tree_node); 
            }
        }
#ifdef TIMING
        gettimeofday(&end, NULL);
        retro_search_time__ += get_tv_diff(start, end);
#endif
        return;
    }