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

Function BuildGraph

tests/unit/test_dfs.c:27–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25static QGEdge *CD;
26
27static QueryGraph *BuildGraph() {
28 // (A)->(B)
29 // (B)->(C)
30 // (C)->(D)
31 size_t node_cap = 4;
32 size_t edge_cap = 3;
33
34 // Create nodes.
35 const char *relation = "R";
36
37 A = QGNode_New("A");
38 B = QGNode_New("B");
39 C = QGNode_New("C");
40 D = QGNode_New("D");
41
42 AB = QGEdge_New(relation, "AB");
43 BC = QGEdge_New(relation, "BC");
44 CD = QGEdge_New(relation, "CD");
45
46 QueryGraph *g = QueryGraph_New(node_cap, edge_cap);
47 QueryGraph_AddNode(g, A);
48 QueryGraph_AddNode(g, B);
49 QueryGraph_AddNode(g, C);
50 QueryGraph_AddNode(g, D);
51
52 QueryGraph_ConnectNodes(g, A, B, AB);
53 QueryGraph_ConnectNodes(g, B, C, BC);
54 QueryGraph_ConnectNodes(g, C, D, CD);
55
56 return g;
57}
58
59void test_DFSLevels() {
60 QGNode *S; // DFS starts here.

Callers 1

test_DFSLevelsFunction · 0.70

Calls 5

QGNode_NewFunction · 0.85
QGEdge_NewFunction · 0.85
QueryGraph_NewFunction · 0.85
QueryGraph_AddNodeFunction · 0.85
QueryGraph_ConnectNodesFunction · 0.85

Tested by

no test coverage detected