-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDriverForGraphProcessor.py
More file actions
53 lines (44 loc) · 1.43 KB
/
DriverForGraphProcessor.py
File metadata and controls
53 lines (44 loc) · 1.43 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
import time
from GraphProcessor import GraphProcessor
from Utility import Utility
'''Get File names and see if they can be opened'''
inputName = input("Input Graph: ")
queryName = input("Query Graph: ")
goodInput = True
try:
open(inputName, "r")
except IOError:
print("Input File Error - check spelling and that file exists")
goodInput = False
try:
open(queryName, "r")
except IOError:
print("Query File Error - check spelling and that file exists")
goodInput = False
if goodInput:
'''Create Graphs'''
myGP = GraphProcessor()
inputGraph = myGP.loadGraph(inputName)
queryGraph = myGP.loadGraph(queryName)
myUtility = Utility()
"""
main output
print stats
"""
print("\n")
print("Input Graph: Nodes - %d; Edges - %d" % (inputGraph.getNumberofVertices(), inputGraph.getNumberofEdges()))
print("Query Graph: Nodes - %d; Edges - %d" % (queryGraph.getNumberofVertices(), queryGraph.getNumberofEdges()))
print("\nQuery Graph (sub-graph) Edges: ")
for item in queryGraph.getEdgeList():
print(item)
h = queryGraph.getNodesSortedByDegree(0)
h1 = h[-1]
print("\nH node = [ %d ]" % h1)
'''run the nemomap alg'''
timeStart = time.time()
totalMappings = myUtility.algorithm2_modified(queryGraph, inputGraph, h1)
timeEnd = time.time()
print("\nMapping: %d" % totalMappings)
print("Time taken: %s seconds" % (timeEnd-timeStart))
else:
exit()