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

Function Graph_CreateEdge

src/graph/graph.c:826–855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

824}
825
826void Graph_CreateEdge
827(
828 Graph *g,
829 NodeID src,
830 NodeID dest,
831 RelationID r,
832 Edge *e
833) {
834 ASSERT(g != NULL);
835 ASSERT(r < Graph_RelationTypeCount(g));
836
837#ifdef RG_DEBUG
838 // make sure both src and destination nodes exists
839 Node node = GE_NEW_NODE();
840 ASSERT(Graph_GetNode(g, src, &node) == true);
841 ASSERT(Graph_GetNode(g, dest, &node) == true);
842#endif
843
844 EdgeID id;
845 AttributeSet *set = DataBlock_AllocateItem(g->edges, &id);
846 *set = NULL;
847
848 e->id = id;
849 e->src_id = src;
850 e->dest_id = dest;
851 e->attributes = set;
852 e->relationID = r;
853
854 Graph_FormConnection(g, src, dest, id, r);
855}
856
857// retrieves all either incoming or outgoing edges
858// to/from given node N, depending on given direction

Callers 8

CreateEdgeFunction · 0.85
BuildGraphFunction · 0.85
_build_graphFunction · 0.85
test_removeNodesFunction · 0.85
test_getEdgeFunction · 0.85

Calls 4

Graph_RelationTypeCountFunction · 0.85
Graph_GetNodeFunction · 0.85
DataBlock_AllocateItemFunction · 0.85
Graph_FormConnectionFunction · 0.85

Tested by 5

BuildGraphFunction · 0.68
_build_graphFunction · 0.68
test_removeNodesFunction · 0.68
test_getEdgeFunction · 0.68