def runSearchAlgorithms(input, algorithm, delay): global time_delay time_delay=delay matrix, start, end=readMatrix(input) G, pos, color_map=initialize(matrix) update(G, pos, color_map) if algorithm == 'bellman': visited, path = bellman(matrix, start, end) searchAnimation(matrix, visited, G, pos, color_map) elif algorithm = 'floyd': path=floyd(matrix, start, end)
def runCP(input, algorithm, delay): global time_delay time_delay=delay matrix, start, end=readMatrix(input, l=1) G, pos, color_map=initialize_uGraph(matrix) update_uGraph(G, pos, color_map) if algorithm == 'connected_components': edges = ConnectedComponents(matrix) else: print("Pass a MST algorithm to run program.") CPAnimations(matrix, edges, G, pos, color_map) while True: quit_event()
def run(input, algorithm, delay): global time_delay time_delay = delay matrix = readMatrix(input) G, pos, color_map = initialize(matrix) update(G, pos, color_map) path = None if algorithm == 'hierholzer': path = Hierholzer(matrix) else: print("Pass a search algorithm to run program.") # searchAnimation(matrix, visited, G, pos, color_map) circle(path, G, pos, color_map) while True: quit_event()
def runMSTs(input, algorithm, delay): global time_delay time_delay=delay matrix, start, end=readMatrix(input, l=1) G, pos, color_map=initialize_uGraph(matrix) update_uGraph(G, pos, color_map) if algorithm == 'prim': edges = Prim(matrix) elif algorithm == 'kruskal': edges= Kruskal(matrix) else: print("Pass a MST algorithm to run program.") MSTAnimations(matrix, edges, G, pos, color_map) while True: quit_event()
def run(input, algorithm, delay): global time_delay time_delay = delay matrix, start, end = readMatrix(input) G, pos, color_map = initialize(matrix) update(G, pos, color_map) if algorithm == 'bfs': visited, path = BFS(matrix, start, end) elif algorithm == 'dfs': visited, path = DFS(matrix, start, end) elif algorithm == 'ucs': visited, path = UCS(matrix, start, end, pos) else: print("Pass a search algorithm to run program.") searchAnimation(matrix, visited, G, pos, color_map) paintPath(path, G, pos, color_map) while True: quit_event()