| 20 | using namespace graphlearn; |
| 21 | |
| 22 | void TestGetEdges(Client* client) { |
| 23 | for (int32_t epoch = 0; epoch < 3; ++epoch) { |
| 24 | for (int32_t iter = 0; iter < 100; ++iter) { |
| 25 | GetEdgesRequest req("click", "by_order", 64, epoch); |
| 26 | GetEdgesResponse res; |
| 27 | Status s = client->GetEdges(&req, &res); |
| 28 | std::cout << "GetEdges: " << s.ToString() << std::endl; |
| 29 | |
| 30 | if (!s.ok()) { |
| 31 | std::cout << "OutOfRange, epoch:" << epoch << std::endl; |
| 32 | break; |
| 33 | } |
| 34 | |
| 35 | const int64_t* src_ids = res.SrcIds(); |
| 36 | const int64_t* dst_ids = res.DstIds(); |
| 37 | const int64_t* edge_ids = res.EdgeIds(); |
| 38 | int32_t size = res.Size(); |
| 39 | std::cout << "Size: " << size << std::endl; |
| 40 | if (epoch == 0 && iter == 0) { |
| 41 | for (int32_t i = 0; i < size; ++i) { |
| 42 | std::cout << src_ids[i] << ", " << dst_ids[i] << ", " << edge_ids[i] << std::endl; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | void TestGetNodes(Client* client) { |
| 50 | for (int32_t epoch = 0; epoch < 3; ++epoch) { |