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

Function AR_STARTNODE

src/arithmetic/entity_funcs/entity_funcs.c:102–115  ·  view source on GitHub ↗

returns the start node of a relationship. */

Source from the content-addressed store, hash-verified

100
101/* returns the start node of a relationship. */
102SIValue AR_STARTNODE(SIValue *argv, int argc, void *private_data) {
103 if(SI_TYPE(argv[0]) == T_NULL) return SI_NullVal();
104 Edge *e = argv[0].ptrval;
105 NodeID start_id = Edge_GetSrcNodeID(e);
106 GraphContext *gc = QueryCtx_GetGraphCtx();
107 Node *src = rm_malloc(sizeof(Node));
108 *src = GE_NEW_NODE();
109 // Retrieve the node from the graph.
110 Graph_GetNode(gc->g, start_id, src);
111 SIValue si_node = SI_Node(src);
112 // Mark this value as a heap allocation so that it gets freed properly.
113 SIValue_SetAllocationType(&si_node, M_SELF);
114 return si_node;
115}
116
117/* returns the end node of a relationship. */
118SIValue AR_ENDNODE(SIValue *argv, int argc, void *private_data) {

Callers

nothing calls this directly

Calls 7

SI_NullValFunction · 0.85
Edge_GetSrcNodeIDFunction · 0.85
QueryCtx_GetGraphCtxFunction · 0.85
rm_mallocFunction · 0.85
Graph_GetNodeFunction · 0.85
SI_NodeFunction · 0.85

Tested by

no test coverage detected