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

Function TestFullSampleNeighbors

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

Source from the content-addressed store, hash-verified

299}
300
301void TestFullSampleNeighbors(Client* client) {
302 SamplingRequest req("click", "FullSampler", 3);
303 int64_t ids[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
304 req.Set(ids, 10);
305
306 SamplingResponse res;
307 Status s = client->Sampling(&req, &res);
308 std::cout << "FullSampleNeighbors: " << s.ToString() << std::endl;
309
310 const int64_t* nbrs = res.GetNeighborIds();
311 int32_t size = res.TotalNeighborCount();
312 std::cout << "TotalNeighborCount: " << size << std::endl;
313 for (int32_t i = 0; i < size; ++i) {
314 std::cout << nbrs[i] << std::endl;
315 }
316
317 int32_t batch_size = res.BatchSize();
318 const int32_t* degrees = res.GetDegrees();
319 for (int32_t i = 0; i < batch_size; ++i) {
320 std::cout << degrees[i] << std::endl;
321 }
322}
323
324void TestNodeWeightNegativeSample(Client* client) {
325 SamplingRequest req("user", "NodeWeightNegativeSampler", 3);

Callers 1

mainFunction · 0.85

Calls 6

GetNeighborIdsMethod · 0.80
TotalNeighborCountMethod · 0.80
SetMethod · 0.45
ToStringMethod · 0.45
BatchSizeMethod · 0.45
GetDegreesMethod · 0.45

Tested by

no test coverage detected