-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_nodes.py
28 lines (22 loc) · 947 Bytes
/
generate_nodes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import random
def generate_nodes():
for i in range(50, 1001, 50):
nodes = []
with open(f"nodes/nodes_{i}.csv", "w") as f:
while len(nodes) < 1000:
random_x = random.randint(0, i)
random_y = random.randint(0, i)
if not nodes.__contains__((random_x, random_y)):
f.write(f"{random_x},{random_y}\n")
nodes.append((random_x, random_y))
def generate_random_topologies(size):
for i in range(size):
nodes = []
with open(f"topologies/topology_{i}.csv", "w") as f:
while len(nodes) < 1000:
random_x = random.randint(0, 100)
random_y = random.randint(0, 100)
if not nodes.__contains__((random_x, random_y)):
f.write(f"{random_x},{random_y}\n")
nodes.append((random_x, random_y))
# generate_random_topologies(15)