-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsection8Samples.py
More file actions
37 lines (28 loc) · 1.17 KB
/
section8Samples.py
File metadata and controls
37 lines (28 loc) · 1.17 KB
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
37
import pandas as pd
import sampleGen
import os
print("starting to generate tests")
df = pd.DataFrame(columns=['Test', 'Vertices', 'Edge Probability', 'filename'])
print("first batch")
# empty graph, one vertex, 5 vertices, and 50 vertices
emptyGraph = sampleGen.generate_graph(0, 0.4)
oneVertex = sampleGen.generate_graph(1, 0.4)
fiveVertices = sampleGen.generate_graph(5, 0.4)
fiftyVertices = sampleGen.generate_graph(50, 0.4)
#Graph with no edges
graphNoEdges = sampleGen.generate_graph(5, 0)
#Graph disconnected
graphDisconnected = sampleGen.generate_graph(5, 0.4, connected=False)
#Graph with all edges
graphAllEdges = sampleGen.generate_graph(10, 1)
graphs = [emptyGraph, oneVertex, fiveVertices, fiftyVertices, graphNoEdges, graphDisconnected, graphAllEdges]
names = ["emptyGraph", "oneVertex", "fiveVertices", "fiftyVertices", "graphNoEdges", "graphDisconnected", "graphAllEdges"]
# Save the graphs
if not os.path.exists("8"):
os.makedirs("8")
for graph, name in zip(graphs, names):
with open(f"8/{name}.txt", "w") as f:
f.write("graph= { \n")
for node, neighbors in graph.items():
f.write(f"\t{node}: {neighbors}\n")
f.write("}\n")