2017-07-11 00:17:18 +08:00
|
|
|
""" This file does nothing, it's just utilities for other setups """
|
|
|
|
|
|
|
|
from random import randint
|
|
|
|
|
|
|
|
|
|
|
|
BATCH_SIZE = 50
|
|
|
|
|
|
|
|
|
|
|
|
def create_vertices(vertex_count):
|
|
|
|
for vertex in range(vertex_count):
|
|
|
|
print("CREATE (:Label {id: %d})" % vertex)
|
2017-07-11 20:43:26 +08:00
|
|
|
if (vertex != 0 and vertex % BATCH_SIZE == 0) or \
|
|
|
|
(vertex + 1 == vertex_count):
|
2017-07-11 00:17:18 +08:00
|
|
|
print(";")
|
|
|
|
|
|
|
|
|
|
|
|
def create_edges(edge_count, vertex_count):
|
|
|
|
""" vertex_count is the number of already existing vertices in graph """
|
|
|
|
for edge in range(edge_count):
|
2017-07-11 20:43:26 +08:00
|
|
|
print("MATCH (a {id: %d}), (b {id: %d}) MERGE (a)-[:Type]->(b)" % (
|
2017-07-11 00:17:18 +08:00
|
|
|
randint(0, vertex_count - 1), randint(0, vertex_count - 1)))
|
2017-07-11 20:43:26 +08:00
|
|
|
print(";")
|
2017-07-11 00:17:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
raise Exception("This file is just for utilities, not for actual setup")
|