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

Function BuildGraph

tests/unit/test_all_paths.c:19–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include "acutest.h"
18
19static Graph *BuildGraph() {
20 Edge e;
21 Node n;
22 size_t nodeCount = 4;
23 Graph *g = Graph_New(nodeCount, nodeCount);
24 int relation = Graph_AddRelationType(g);
25 for(int i = 0; i < 4; i++) {
26 n = GE_NEW_NODE();
27 Graph_CreateNode(g, &n, NULL, 0);
28 }
29
30 /* Connections:
31 * 0 -> 1
32 * 0 -> 2
33 * 1 -> 0
34 * 1 -> 2
35 * 2 -> 1
36 * 2 -> 3
37 * 3 -> 0 */
38
39 // Connections:
40 // 0 -> 1
41 Graph_CreateEdge(g, 0, 1, relation, &e);
42 // 0 -> 2
43 Graph_CreateEdge(g, 0, 2, relation, &e);
44 // 1 -> 0
45 Graph_CreateEdge(g, 1, 0, relation, &e);
46 // 1 -> 2
47 Graph_CreateEdge(g, 1, 2, relation, &e);
48 // 2 -> 1
49 Graph_CreateEdge(g, 2, 1, relation, &e);
50 // 2 -> 3
51 Graph_CreateEdge(g, 2, 3, relation, &e);
52 // 3 -> 0
53 Graph_CreateEdge(g, 3, 0, relation, &e);
54 return g;
55}
56
57// This function tests for membership of a path, inside an array of multiple paths.
58bool pathArrayContainsPath(NodeID **array, int arrayLen, Path *path) {

Callers 5

test_noPathsFunction · 0.70
test_longest_PathsFunction · 0.70
test_upToThreeLegsPathsFunction · 0.70
test_twoLegPathsFunction · 0.70

Calls 4

Graph_NewFunction · 0.85
Graph_AddRelationTypeFunction · 0.85
Graph_CreateNodeFunction · 0.85
Graph_CreateEdgeFunction · 0.85

Tested by

no test coverage detected