label node with each label in 'lbls'
| 708 | |
| 709 | // label node with each label in 'lbls' |
| 710 | void Graph_LabelNode |
| 711 | ( |
| 712 | Graph *g, // graph to operate on |
| 713 | NodeID id, // node ID to update |
| 714 | LabelID *lbls, // set to labels to associate with node |
| 715 | uint lbl_count // number of labels |
| 716 | ) { |
| 717 | // validations |
| 718 | ASSERT(g != NULL); |
| 719 | ASSERT(lbls != NULL); |
| 720 | ASSERT(lbl_count > 0); |
| 721 | ASSERT(id != INVALID_ENTITY_ID); |
| 722 | |
| 723 | GrB_Info info; |
| 724 | UNUSED(info); |
| 725 | |
| 726 | RG_Matrix nl = Graph_GetNodeLabelMatrix(g); |
| 727 | for(uint i = 0; i < lbl_count; i++) { |
| 728 | LabelID l = lbls[i]; |
| 729 | RG_Matrix L = Graph_GetLabelMatrix(g, l); |
| 730 | |
| 731 | // set matrix at position [id, id] |
| 732 | info = RG_Matrix_setElement_BOOL(L, id, id); |
| 733 | ASSERT(info == GrB_SUCCESS); |
| 734 | |
| 735 | // map this label in this node's set of labels |
| 736 | info = RG_Matrix_setElement_BOOL(nl, id, l); |
| 737 | ASSERT(info == GrB_SUCCESS); |
| 738 | |
| 739 | // update labels statistics |
| 740 | GraphStatistics_IncNodeCount(&g->stats, l, 1); |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | // return true if node is labeled as 'l' |
| 745 | bool Graph_IsNodeLabeled |
no test coverage detected