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

Function _CollectEdgesFromEntry

src/graph/graph.c:98–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98static void _CollectEdgesFromEntry
99(
100 const Graph *g,
101 NodeID src,
102 NodeID dest,
103 RelationID r,
104 EdgeID edgeId,
105 Edge **edges
106) {
107 Edge e = {0};
108
109 e.src_id = src;
110 e.dest_id = dest;
111 e.relationID = r;
112
113 if(SINGLE_EDGE(edgeId)) {
114 e.id = edgeId;
115 e.attributes = DataBlock_GetItem(g->edges, edgeId);
116 ASSERT(e.attributes);
117 array_append(*edges, e);
118 } else {
119 // multiple edges connecting src to dest,
120 // entry is a pointer to an array of edge IDs
121 EdgeID *edgeIds = (EdgeID *)(CLEAR_MSB(edgeId));
122 uint edgeCount = array_len(edgeIds);
123
124 for(uint i = 0; i < edgeCount; i++) {
125 edgeId = edgeIds[i];
126 e.id = edgeId;
127 e.attributes = DataBlock_GetItem(g->edges, edgeId);
128 ASSERT(e.attributes);
129 array_append(*edges, e);
130 }
131 }
132}
133
134// Locates edges connecting src to destination.
135void _Graph_GetEdgesConnectingNodes

Callers 2

Graph_GetNodeEdgesFunction · 0.85

Calls 2

DataBlock_GetItemFunction · 0.85
array_lenFunction · 0.85

Tested by

no test coverage detected