MCPcopy Create free account
hub / github.com/alibaba/graph-learn / TestTopkSampleNeighbors

Function TestTopkSampleNeighbors

graphlearn/src/service/test/client_test.cpp:284–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284void TestTopkSampleNeighbors(Client* client) {
285 SamplingRequest req("click", "TopkSampler", 3);
286 int64_t ids[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
287 req.Set(ids, 10);
288
289 SamplingResponse res;
290 Status s = client->Sampling(&req, &res);
291 std::cout << "SampleTopkNeighbors: " << s.ToString() << std::endl;
292
293 const int64_t* nbrs = res.GetNeighborIds();
294 int32_t size = res.TotalNeighborCount();
295 std::cout << "TotalNeighborCount: " << size << std::endl;
296 for (int32_t i = 0; i < size; ++i) {
297 std::cout << nbrs[i] << std::endl;
298 }
299}
300
301void TestFullSampleNeighbors(Client* client) {
302 SamplingRequest req("click", "FullSampler", 3);

Callers 1

mainFunction · 0.85

Calls 4

GetNeighborIdsMethod · 0.80
TotalNeighborCountMethod · 0.80
SetMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected