-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
67 lines (57 loc) · 1.79 KB
/
main.py
File metadata and controls
67 lines (57 loc) · 1.79 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
66
67
import os
from Path import *
from RouteVar import *
from Stop import *
from Graph import *
from GPT_Gorrilla.model import predict
print("...........Handling data ...........")
pathquery = PathQuery()
stopquery = StopQuery()
routevarquery = RouteVarQuery()
data_dir = os.path.join(os.getcwd(), "data")
path_dir = os.path.join(data_dir, "paths.json")
route_dir = os.path.join(data_dir, "vars.json")
stop_dir = os.path.join(data_dir, "stops.json")
pathquery.read_data(path_dir)
print("....Reading path data complete.....")
route_dict = routevarquery.readData(route_dir)
print("....Reading route data complete.....")
stop_dict = stopquery.read_data(stop_dir)
print("....Reading stop data complete.....")
edgesquery = EdgesQuery()
needed_data, coordinates_dict = edgesquery.handle_data(stopsquery= stopquery, pathsquery=pathquery, route_dict = route_dict, stop_dict= stop_dict)
set_stop = set(stop.getStop("stopId")["stopId"] for stop in stopquery.stopquery)
busgraph = BusGraph(stops = set_stop, edges = needed_data, coordinates_dict = coordinates_dict)
print("......Handling edges complete.....")
busgraph.bfs_all_pairs()
"""
# Week 10:
try:
# For a specific one
busgraph.astar(start_stop = 1, goal_stop=10)
# All pairs
busgraph.dijkstras_all_stops()
busgraph.esopo_pape_all_pairs()
busgraph.bfs_all_pairs()
# K importances
busgraph.esopo_k_important(10)
busgraph.dijkstras_k_important(10)
except ValueError:
print("Can not do it")
"""
"""
# Week 11:
queries = {
"routevarquery": routevarquery,
"pathquery": pathquery,
"stopquery": stopquery,
"busgraph": busgraph,
"edgesquery": edgesquery,
}
query = "Find the shortest path from stop 1 to stop 10"
try :
result = predict(query, queries=queries)
print(result)
except:
print("Can not do it")
"""