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

Function Graph_CreateNode

src/graph/graph.c:682–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

680}
681
682void Graph_CreateNode
683(
684 Graph *g,
685 Node *n,
686 LabelID *labels,
687 uint label_count
688) {
689 ASSERT(g != NULL);
690 ASSERT(n != NULL);
691 ASSERT(label_count == 0 || (label_count > 0 && labels != NULL));
692
693 NodeID id = n->id; // save node ID
694 n->attributes = DataBlock_AllocateItem(g->nodes, &n->id);
695 *n->attributes = NULL; // initialize attributes to NULL
696
697 // node ID was reserved, make reserved ID was assigned
698 if(id != INVALID_ENTITY_ID) {
699 ASSERT(id == n->id);
700 g->reserved_node_count--;
701 ASSERT(g->reserved_node_count >= 0);
702 }
703
704 if(label_count > 0) {
705 Graph_LabelNode(g, ENTITY_GET_ID(n), labels, label_count);
706 }
707}
708
709// label node with each label in 'lbls'
710void Graph_LabelNode

Callers 12

CreateNodeFunction · 0.85
BuildGraphFunction · 0.85
_build_graphFunction · 0.85
_test_node_creationFunction · 0.85
test_removeNodesFunction · 0.85
test_getNodeFunction · 0.85
test_getEdgeFunction · 0.85

Calls 2

DataBlock_AllocateItemFunction · 0.85
Graph_LabelNodeFunction · 0.85

Tested by 9

BuildGraphFunction · 0.68
_build_graphFunction · 0.68
_test_node_creationFunction · 0.68
test_removeNodesFunction · 0.68
test_getNodeFunction · 0.68
test_getEdgeFunction · 0.68