MCPcopy Create free account
hub / github.com/Tencent/embedx / SampleSubGraph

Method SampleSubGraph

src/model/data_flow/neighbor_aggregation_flow.cc:48–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46} // namespace
47
48void NeighborAggregationFlow::SampleSubGraph(
49 const vec_int_t& nodes, const std::vector<int>& num_neighbors,
50 vec_set_t* level_nodes, vec_map_neigh_t* level_neighs) const {
51 int graph_depth = num_neighbors.size();
52 level_nodes->resize(graph_depth + 1);
53 level_neighs->resize(graph_depth + 1);
54 (*level_nodes)[0].clear();
55 (*level_nodes)[0].insert(nodes.begin(), nodes.end());
56
57 vec_int_t tmp_nodes;
58 std::vector<vec_int_t> tmp_neighbors_list;
59
60 for (size_t i = 0; i < num_neighbors.size(); ++i) {
61 (*level_nodes)[i + 1].clear();
62 (*level_neighs)[i].clear();
63
64 tmp_nodes.assign((*level_nodes)[i].begin(), (*level_nodes)[i].end());
65 graph_client_.RandomSampleNeighbor(num_neighbors[i], tmp_nodes,
66 &tmp_neighbors_list);
67 for (size_t j = 0; j < tmp_nodes.size(); ++j) {
68 (*level_nodes)[i + 1].insert(tmp_neighbors_list[j].begin(),
69 tmp_neighbors_list[j].end());
70 (*level_neighs)[i].emplace(tmp_nodes[j], tmp_neighbors_list[j]);
71 }
72 }
73}
74
75void NeighborAggregationFlow::MergeTo(const vec_int_t& src_nodes,
76 vec_int_t* dst_nodes) const {

Callers 15

TEST_FFunction · 0.80
FillInstanceMethod · 0.80
GetTrainBatchMethod · 0.80
GetTrainBatchMethod · 0.80
GetPredictBatchMethod · 0.80
GetTrainBatchMethod · 0.80
GetTrainBatchMethod · 0.80
GetPredictBatchMethod · 0.80
GetTrainBatchMethod · 0.80
GetPredictBatchMethod · 0.80

Calls 3

emplaceMethod · 0.80
clearMethod · 0.45
RandomSampleNeighborMethod · 0.45

Tested by 1

TEST_FFunction · 0.64