memgraph/tests/benchmark_infra/groups/delete/setup.py
Mislav Bradac ec32ae8bad Fix delete and aggregation benchmarks
Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D539
2017-07-11 19:58:03 +02:00

36 lines
1.1 KiB
Python

""" This file does nothing, it's just utilities for other setups """
from random import randint
BATCH_SIZE = 100
def create_vertices(vertex_count):
for vertex in range(vertex_count):
print("CREATE (:Label {id: %d})" % vertex)
if (vertex != 0 and vertex % BATCH_SIZE == 0) or \
(vertex + 1 == vertex_count):
print(";")
def create_edges(edge_count, vertex_count):
""" vertex_count is the number of already existing vertices in graph """
matches = []
merges = []
for edge in range(edge_count):
matches.append("MATCH (a%d {id: %d}), (b%d {id: %d})" %
(edge, randint(0, vertex_count - 1),
edge, randint(0, vertex_count - 1)))
merges.append("CREATE (a%d)-[:Type]->(b%d)" % (edge, edge))
if (edge != 0 and edge % BATCH_SIZE == 0) or \
((edge + 1) == edge_count):
print(" ".join(matches + merges))
print(";")
matches = []
merges = []
if __name__ == '__main__':
raise Exception("This file is just for utilities, not for actual setup")