-
Notifications
You must be signed in to change notification settings - Fork 0
/
PathFinder.py
executable file
·63 lines (57 loc) · 1.95 KB
/
PathFinder.py
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
from Graph import Graph
from Menu import Menu
from SearchPathMenu import SearchPathMenu
from TypesInformedSearch import TypesInformedSearch
from VertexManagementMenu import VertexManagementMenu
class PathFinder:
def __init__(self) -> None:
self.__graph: Graph = None
self.__menus: list[Menu] = [
Menu(
"Buscador de rutas",
[
"Gestión del grafo",
"Búsqueda de la ruta más corta",
"Salir",
],
),
VertexManagementMenu(
"Gestión del grafo",
[
"Ingreso de vértice",
"Actualización de vértice",
"Eliminación de vértice",
"Unir vértices",
"Volver",
],
),
SearchPathMenu(
"Búsqueda de la ruta más corta",
[
TypesInformedSearch.get(0),
TypesInformedSearch.get(1),
"Volver",
],
),
]
def interact(self):
main_menu = self.__menus[0]
main_menu.interact()
is_back = False
while not main_menu.is_option_exit():
if main_menu.is_option(1):
vertex_menu = self.__menus[1]
vertex_menu.interact()
self.__graph = vertex_menu.get_graph()
is_back = vertex_menu.is_option_exit()
if main_menu.is_option(2):
search_menu = self.__menus[main_menu.get_option()]
if self.__graph:
search_menu.interact(self.__graph)
is_back = search_menu.is_option_exit()
else:
input("Error!!! No hay grafo...")
is_back = True
if is_back:
main_menu.interact()
PathFinder().interact()