-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
executable file
·32 lines (27 loc) · 854 Bytes
/
test.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
import time
from Project.parser import Parser
from Project.node import Node
from Project.dfs import DFS
from Project.idastar import IDAstar
testfile = 'sampleGraph1.txt'
db = Parser()
start_time = time.time()
db.parse(testfile)
print("\n---Parsing took %s seconds---\n" % (time.time() - start_time))
start_time = time.time()
nd = Node(testfile)
nd.insertGraph()
print("\n---Making the Graph took %s seconds---\n" % (time.time() - start_time))
print('Starting DFS...')
start_time = time.time()
df = DFS(testfile)
df.run(nd.Source, nd.Dest)
print('Path:', df.returnPath())
df.printCostofPath()
print("\n---DFS took %s seconds---\n" % (time.time() - start_time))
start_time = time.time()
ida = IDAstar(testfile)
print(ida.run())
print('Expands:', ida.expands)
print(ida.returnPath())
print("\n---IDA* took %s seconds---\n" % (time.time() - start_time))