populate array of node's label IDs, return number of labels on node
| 1049 | |
| 1050 | // populate array of node's label IDs, return number of labels on node |
| 1051 | uint Graph_GetNodeLabels |
| 1052 | ( |
| 1053 | const Graph *g, // graph the node belongs to |
| 1054 | const Node *n, // node to extract labels from |
| 1055 | LabelID *labels, // array to populate with labels |
| 1056 | uint label_count // size of labels array |
| 1057 | ) { |
| 1058 | // validate inputs |
| 1059 | ASSERT(g != NULL); |
| 1060 | ASSERT(n != NULL); |
| 1061 | ASSERT(labels != NULL); |
| 1062 | |
| 1063 | GrB_Info res; |
| 1064 | UNUSED(res); |
| 1065 | |
| 1066 | // GrB_Col_extract will iterate over the range of the output size |
| 1067 | RG_Matrix M = Graph_GetNodeLabelMatrix(g); |
| 1068 | |
| 1069 | EntityID id = ENTITY_GET_ID(n); |
| 1070 | RG_MatrixTupleIter iter = {0}; |
| 1071 | res = RG_MatrixTupleIter_AttachRange(&iter, M, id, id); |
| 1072 | ASSERT(res == GrB_SUCCESS); |
| 1073 | |
| 1074 | uint i = 0; |
| 1075 | |
| 1076 | for(; i < label_count; i++) { |
| 1077 | GrB_Index col; |
| 1078 | res = RG_MatrixTupleIter_next_BOOL(&iter, NULL, &col, NULL); |
| 1079 | labels[i] = col; |
| 1080 | |
| 1081 | if(res == GxB_EXHAUSTED) break; |
| 1082 | } |
| 1083 | |
| 1084 | RG_MatrixTupleIter_detach(&iter); |
| 1085 | |
| 1086 | return i; |
| 1087 | } |
| 1088 | |
| 1089 | // removes edges from Graph and updates graph relevant matrices |
| 1090 | void Graph_DeleteEdges |
no test coverage detected