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

Method DeSerialize

euler/core/graph/node.cc:414–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412#undef GET_NODE_FEATURE_VEC
413
414bool Node::DeSerialize(const char* s, size_t size) {
415 BytesReader bytes_reader(s, size);
416 if (!bytes_reader.Read(&id_) || // parse node id
417 !bytes_reader.Read(&type_) || // parse node type
418 !bytes_reader.Read(&weight_)) { // parse node weight
419 EULER_LOG(ERROR) << "node info error";
420 return false;
421 }
422
423 std::vector<int32_t> edge_group_ids;
424 std::vector<float> edge_group_weights;
425 if (!bytes_reader.Read(&edge_group_ids)) {
426 EULER_LOG(ERROR) << "edge group id list error, node_id: " << id_;
427 return false;
428 }
429
430 if (!bytes_reader.Read(&edge_group_weights)) {
431 EULER_LOG(ERROR) << "edge group weight list error, node_id: " << id_;
432 return false;
433 }
434
435 // build edge_group_collection_
436 if (!neighbor_info_.edge_group_collection.Init(edge_group_ids,
437 edge_group_weights)) {
438 EULER_LOG(ERROR) << "neighbor edge group collection error, node_id: "
439 << id_;
440 return false;
441 }
442
443 // build neighbors info
444 if (!bytes_reader.Read(&neighbor_info_.neighbor_groups_idx)) {
445 EULER_LOG(ERROR) << "neighbor groups idx error, node_id: " << id_;
446 return false;
447 }
448
449 if (!bytes_reader.Read(&neighbor_info_.neighbors)) {
450 EULER_LOG(ERROR) << "neighbors error, node_id: " << id_;
451 return false;
452 }
453
454 if (!bytes_reader.Read(&neighbor_info_.neighbors_weight)) {
455 EULER_LOG(ERROR) << "neighbors weights error, node_id: " << id_;
456 return false;
457 }
458
459 edge_group_ids.clear();
460 edge_group_weights.clear();
461 if (!bytes_reader.Read(&edge_group_ids)) {
462 EULER_LOG(ERROR) << "edge group id list error, node_id: " << id_;
463 return false;
464 }
465
466 if (!bytes_reader.Read(&edge_group_weights)) {
467 EULER_LOG(ERROR) << "edge group weight list error, node_id: " << id_;
468 return false;
469 }
470
471 // build edge_group_collection_

Callers 4

TESTFunction · 0.45
TESTFunction · 0.45
ParseNodesMethod · 0.45
ParseEdgesMethod · 0.45

Calls 2

ReadMethod · 0.45
InitMethod · 0.45

Tested by 2

TESTFunction · 0.36
TESTFunction · 0.36