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

Function run_random_graph_ops

tests/flow/random_graph.py:204–223  ·  view source on GitHub ↗

Run random graph write operations Example: nodes, edges = create_random_schema() res = create_random_graph(redis_graph, nodes, edges) res = run_random_graph_ops(redis_graph, nodes, edges, ALL_OPS)

(g, nodes, edges, ops)

Source from the content-addressed store, hash-verified

202
203
204def run_random_graph_ops(g, nodes, edges, ops):
205 """
206 Run random graph write operations
207 Example:
208 nodes, edges = create_random_schema()
209 res = create_random_graph(redis_graph, nodes, edges)
210 res = run_random_graph_ops(redis_graph, nodes, edges, ALL_OPS)
211 """
212 result = []
213 total = {}
214 for i in range(0, randint(10, 1000)):
215 op = randint(0, len(ops) - 1)
216 params, query = ops[op](nodes, edges)
217 # print(query)
218 res = g.query(query, params)
219 res.nodes_created
220 res.nodes_created
221 result.append(res)
222
223 return total, result
224
225
226def create_random_schema():

Callers 2

test12_random_graphMethod · 0.90
test_15_random_opsMethod · 0.90

Calls 1

queryMethod · 0.45

Tested by 2

test12_random_graphMethod · 0.72
test_15_random_opsMethod · 0.72