| 680 | } |
| 681 | |
| 682 | void 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' |
| 710 | void Graph_LabelNode |