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

Function Graph_FormConnection

src/graph/graph.c:796–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794}
795
796bool 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
826void Graph_CreateEdge
827(

Callers 2

Serializer_Graph_SetEdgeFunction · 0.85
Graph_CreateEdgeFunction · 0.85

Calls 5

Graph_GetRelationMatrixFunction · 0.85
Graph_GetAdjacencyMatrixFunction · 0.85

Tested by

no test coverage detected