-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlgorithm.py
More file actions
32 lines (29 loc) · 851 Bytes
/
Copy pathAlgorithm.py
File metadata and controls
32 lines (29 loc) · 851 Bytes
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
"""
Generic Algorithm Class that the search algorithms will inherit from
Has:
Run method (will be overwritten)
"""
from Node import *
from Graph import *
from tkinter import *
#Base class from which all algorithms inherit
class Algorithm():
def __init__(self,graph,startNodeNumber, endNodeNumber, GUI = None):
self.visited = []
self.unVisited = []
self.finalPath = []
self.startNodeNumber = startNodeNumber
self.endNodeNumber = endNodeNumber
self.foundGoal = False
self.graph = graph
if(GUI is not None):
self.GUI = GUI
else:
self.GUI = None
def updatePlot(self, number, color):
self.GUI.nodes[number].configure(bg=color)
self.GUI.win.update()
def run(self):
pass
def getPath(self):
return self.finalPath