| 794 | } |
| 795 | |
| 796 | bool Graph_FormConnection |
| 797 | ( |
| 798 | Graph *g, |
| 799 | NodeID src, |
| 800 | NodeID dest, |
| 801 | EdgeID edge_id, |
| 802 | int r |
| 803 | ) { |
| 804 | ASSERT(g != NULL); |
| 805 | |
| 806 | GrB_Info info; |
| 807 | UNUSED(info); |
| 808 | RG_Matrix M = Graph_GetRelationMatrix(g, r, false); |
| 809 | RG_Matrix adj = Graph_GetAdjacencyMatrix(g, false); |
| 810 | |
| 811 | // rows represent source nodes, columns represent destination nodes |
| 812 | info = RG_Matrix_setElement_BOOL(adj, src, dest); |
| 813 | // incase of decoding it is possible to write outside of matrix bounds |
| 814 | // exit early |
| 815 | if(info != GrB_SUCCESS) return false; |
| 816 | |
| 817 | info = RG_Matrix_setElement_UINT64(M, edge_id, src, dest); |
| 818 | if(info != GrB_SUCCESS) return false; |
| 819 | |
| 820 | // an edge of type r has just been created, update statistics |
| 821 | GraphStatistics_IncEdgeCount(&g->stats, r, 1); |
| 822 | |
| 823 | return true; |
| 824 | } |
| 825 | |
| 826 | void Graph_CreateEdge |
| 827 | ( |
no test coverage detected