MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / Serializer_Graph_SetNode

Function Serializer_Graph_SetNode

src/serializers/graph_extensions.c:60–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void Serializer_Graph_SetNode
61(
62 Graph *g,
63 NodeID id,
64 LabelID *labels,
65 uint label_count,
66 Node *n
67) {
68 ASSERT(g);
69
70 AttributeSet *set = DataBlock_AllocateItemOutOfOrder(g->nodes, id);
71 *set = NULL;
72
73 n->id = id;
74 n->attributes = set;
75 GrB_Info info;
76 UNUSED(info);
77
78 for(uint i = 0; i < label_count; i ++) {
79 LabelID label = labels[i];
80 // set label matrix at position [id, id]
81 RG_Matrix M = Graph_GetLabelMatrix(g, label);
82 GrB_Matrix m = RG_MATRIX_M(M);
83 info = GrB_Matrix_setElement_BOOL(m, true, id, id);
84 if(info == GrB_INVALID_INDEX) {
85 RedisModule_Log(NULL, "notice", "RESIZE LABEL MATRIX");
86 Graph_EnsureNodeCap(g, id);
87 info = GrB_Matrix_setElement_BOOL(m, true, id, id);
88 }
89 ASSERT(info == GrB_SUCCESS);
90 }
91}
92
93// computes NodeLabelMarix out of label matrices
94// NodeLabelMatrix[:i] = diag(LabelMatrix[i])

Callers 6

RdbLoadNodes_v13Function · 0.85
RdbLoadNodes_v11Function · 0.85
RdbLoadNodes_v9Function · 0.85
RdbLoadNodes_v10Function · 0.85
RdbLoadNodes_v8Function · 0.85
RdbLoadNodes_v12Function · 0.85

Calls 3

Graph_GetLabelMatrixFunction · 0.85
Graph_EnsureNodeCapFunction · 0.85

Tested by

no test coverage detected