forked from gpspelle/game-theory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_graphs.py
36 lines (28 loc) · 950 Bytes
/
create_graphs.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
29
30
31
32
33
34
35
36
import os
import math
#Parameters to be defined for each test
#For comparison, the number of graphs shold be high and constant
num_graphs = 1
size = 30
dist = "poisson"
lam = 15
folder = "tests_n_" + str(size) + "_dist_" + dist
if dist == "poisson":
folder = folder + "_lam_" + str(lam) + "/"
else:
folder = folder + "/"
base_name = "test"
#defining number of digits for name encoding
nDigits = math.trunc(math.log10(num_graphs)) + 1
if not os.path.exists(folder):
os.makedirs(folder)
print("Creating graphs\n")
for i in range(num_graphs):
print("Created", str(i+1).zfill(nDigits), "of", num_graphs)
os.system("python3 generate_graph.py --fname " + folder +
base_name + str(i).zfill(nDigits) + ".gm --size " + str(size) + " --dist " + dist
+ " --lam " + str(lam))
#File Structure
print("\nFile Structure:")
print("Header: purpose number_of_nodes")
print("Body: node_name color player neighbours id_code")