MCPcopy Create free account
hub / github.com/alibaba/euler / LoadMeta

Method LoadMeta

euler/core/graph/graph_builder.cc:230–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228
229
230Status GraphBuilder::LoadMeta(Slice meta_path, GraphMeta* meta) {
231 std::unique_ptr<FileIO> reader;
232 RETURN_IF_ERROR(Env::Default()->NewFileIO(meta_path, true, &reader));
233
234 std::vector<std::string> meta_infos;
235 std::string name, version;
236 uint64_t node_count, edge_count;
237 int partitions_num = 0;
238
239 reader->Read(&name);
240 reader->Read(&version);
241 reader->Read(&node_count);
242 reader->Read(&edge_count);
243 reader->Read(&partitions_num);
244
245 uint32_t node_meta_count;
246 reader->Read(&node_meta_count);
247
248 FeatureInfoMap nfm, efm;
249 for (size_t i = 0; i < node_meta_count; i++) {
250 std::string fname;
251 FeatureType type;
252 int32_t idx;
253 int64_t dim;
254 reader->Read(&fname);
255 reader->Read(&type);
256 reader->Read(&idx);
257 reader->Read(&dim);
258 nfm.insert(
259 std::make_pair(
260 fname, std::make_tuple(type, idx, dim)));
261 }
262
263 uint32_t edge_meta_count;
264 reader->Read(&edge_meta_count);
265 for (size_t i = 0; i < edge_meta_count; i++) {
266 std::string fname;
267 FeatureType type;
268 int32_t idx;
269 int64_t dim;
270 reader->Read(&fname);
271 reader->Read(&type);
272 reader->Read(&idx);
273 reader->Read(&dim);
274 efm.insert(
275 std::make_pair(
276 fname, std::make_tuple(type, idx, dim)));
277 }
278
279 std::unordered_map<std::string, uint32_t> node_type_map;
280 std::unordered_map<std::string, uint32_t> edge_type_map;
281
282 uint32_t node_type_num = 0;
283 reader->Read(&node_type_num);
284 for (uint32_t i = 0; i < node_type_num; ++i) {
285 std::string node_type;
286 uint32_t index = 0;
287 reader->Read(&node_type);

Callers

nothing calls this directly

Calls 4

NewFileIOMethod · 0.80
ReadMethod · 0.45
InitMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected