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

Function Graph_RemoveNodeLabels

src/graph/graph.c:763–794  ·  view source on GitHub ↗

dissociates each label in 'lbls' from given node

Source from the content-addressed store, hash-verified

761
762// dissociates each label in 'lbls' from given node
763void Graph_RemoveNodeLabels
764(
765 Graph *g, // graph to operate against
766 NodeID id, // node ID to update
767 LabelID *lbls, // set of labels to remove
768 uint lbl_count // number of labels to remove
769) {
770 ASSERT(g != NULL);
771 ASSERT(id != INVALID_ENTITY_ID);
772 ASSERT(lbls != NULL);
773 ASSERT(lbl_count > 0);
774
775 GrB_Info info;
776 UNUSED(info);
777
778 RG_Matrix nl = Graph_GetNodeLabelMatrix(g);
779 for(uint i = 0; i < lbl_count; i++) {
780 LabelID l = lbls[i];
781 RG_Matrix M = Graph_GetLabelMatrix(g, l);
782
783 // remove matrix at position [id, id]
784 info = RG_Matrix_removeElement_BOOL(M, id, id);
785 ASSERT(info == GrB_SUCCESS);
786
787 // remove this label from node's set of labels
788 info = RG_Matrix_removeElement_BOOL(nl, id, l);
789 ASSERT(info == GrB_SUCCESS);
790
791 // a label was removed from node, update statistics
792 GraphStatistics_DecNodeCount(&g->stats, l, 1);
793 }
794}
795
796bool Graph_FormConnection
797(

Callers 2

UpdateNodeLabelsFunction · 0.85

Calls 4

Graph_GetNodeLabelMatrixFunction · 0.85
Graph_GetLabelMatrixFunction · 0.85

Tested by

no test coverage detected