-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphTester.py
More file actions
66 lines (42 loc) · 1.13 KB
/
GraphTester.py
File metadata and controls
66 lines (42 loc) · 1.13 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import numpy as np
import networkx as nx
import GraphGenerator as gg
import Constraint
class GraphTester():
def __init__(self):
"""
Initilaize a tester object for the graph generator software
"""
self.testArray = None
# End def __init__
def generateInputArray(self, rows, columns):
"""
Generate an array of random values between 0.00 and 1.00
"""
testArray = np.random.random_sample( (rows,columns) )
self.testArray = testArray
# End def generateInputArray
def generateInputArrayFromFile(self, fileName):
"""
Generates an array of values between 0.00 and 1.00 from an input file
"""
def runTest(self):
"""
Use the randomly generated array to test the graph generator
"""
cycleConstraint = Constraint.cycleConstraint()
generator = gg.GraphGenerator()
generator.registerConstraints(cycleConstraint)
generator.generateGraph(self.testArray, 0.1)
#generator.outputGraph(3, "testGraph")
graph = generator.getGraphObject()
print nx.info(graph)
# End def runTest
def main():
"""
Test the graph generator
"""
tester = GraphTester()
tester.generateInputArray(10,10)
tester.runTest()
main()