Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
0
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()